2019-05-13 19:59:28 +02:00
|
|
|
/*
|
|
|
|
* This file is a part of morm
|
|
|
|
* and is distributed under the 2-Clause BSD licence.
|
|
|
|
* Author: Tomasz Sowa <t.sowa@ttmath.org>
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2019, Tomasz Sowa
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions are met:
|
|
|
|
*
|
|
|
|
* 1. Redistributions of source code must retain the above copyright notice,
|
|
|
|
* this list of conditions and the following disclaimer.
|
|
|
|
*
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
|
|
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef headerfile_morm_modelenv
|
|
|
|
#define headerfile_morm_modelenv
|
|
|
|
|
|
|
|
#include "modeldata.h"
|
2019-05-21 17:51:13 +02:00
|
|
|
#include "cursorhelper.h"
|
|
|
|
#include "finderhelper.h"
|
2019-05-13 19:59:28 +02:00
|
|
|
#include "morm_types.h"
|
|
|
|
|
|
|
|
|
|
|
|
namespace morm
|
|
|
|
{
|
|
|
|
|
|
|
|
class ModelEnv
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
ModelData * model_data;
|
2019-05-21 17:51:13 +02:00
|
|
|
FinderHelper * finder_helper;
|
|
|
|
CursorHelper * cursor_helper;
|
|
|
|
|
2019-05-13 19:59:28 +02:00
|
|
|
int model_connector_mode;
|
|
|
|
const void * doc_field_pointer;
|
|
|
|
|
2019-05-21 19:24:12 +02:00
|
|
|
PT::TextStream table_name;
|
2019-05-31 20:28:09 +02:00
|
|
|
PT::TextStream table_name_short;
|
2019-05-21 19:24:12 +02:00
|
|
|
int table_index;
|
|
|
|
|
|
|
|
|
2019-05-13 19:59:28 +02:00
|
|
|
|
|
|
|
ModelEnv()
|
|
|
|
{
|
|
|
|
clear();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
~ModelEnv()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ModelEnv(const ModelEnv & e)
|
|
|
|
{
|
|
|
|
model_data = e.model_data;
|
2019-05-21 17:51:13 +02:00
|
|
|
finder_helper = e.finder_helper;
|
|
|
|
cursor_helper = e.cursor_helper;
|
2019-05-13 19:59:28 +02:00
|
|
|
model_connector_mode = e.model_connector_mode;
|
|
|
|
table_index = e.table_index;
|
|
|
|
doc_field_pointer = e.doc_field_pointer;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2019-05-21 19:24:12 +02:00
|
|
|
void copy_global_objects(const ModelEnv & e)
|
|
|
|
{
|
|
|
|
model_data = e.model_data;
|
|
|
|
finder_helper = e.finder_helper;
|
|
|
|
cursor_helper = e.cursor_helper;
|
|
|
|
|
|
|
|
model_connector_mode = e.model_connector_mode;
|
|
|
|
|
|
|
|
// what about doc_field_pointer?
|
|
|
|
}
|
|
|
|
|
2019-05-13 19:59:28 +02:00
|
|
|
void clear()
|
|
|
|
{
|
|
|
|
model_data = nullptr;
|
2019-05-21 17:51:13 +02:00
|
|
|
finder_helper = nullptr;
|
|
|
|
cursor_helper = nullptr;
|
2019-05-13 19:59:28 +02:00
|
|
|
model_connector_mode = MORM_MODEL_CONNECTOR_MODE_NONE;
|
|
|
|
doc_field_pointer = nullptr;
|
2019-05-21 19:24:12 +02:00
|
|
|
table_name.clear();
|
2019-05-31 20:28:09 +02:00
|
|
|
table_name_short.clear();
|
2019-05-21 19:24:12 +02:00
|
|
|
table_index = 0;
|
2019-05-13 19:59:28 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|