#include <OTVariable.hpp>
Definition at line 145 of file OTVariable.hpp.
Enumerator |
---|
Var_Constant |
|
Var_Persistent |
|
Var_Important |
|
Var_Error_Access |
|
Definition at line 155 of file OTVariable.hpp.
Enumerator |
---|
Var_String |
|
Var_Integer |
|
Var_Bool |
|
Var_Error_Type |
|
Definition at line 148 of file OTVariable.hpp.
opentxs::OTVariable::OTVariable |
( |
| ) |
|
Definition at line 266 of file OTVariable.cpp.
268 : m_strName(str_Name.c_str())
271 , m_nValueBackup(nValue)
272 , m_bValueBackup(
false)
275 , m_Access(theAccess)
Definition at line 281 of file OTVariable.cpp.
283 : m_strName(str_Name.c_str())
287 , m_bValueBackup(bValue)
290 , m_Access(theAccess)
Definition at line 247 of file OTVariable.cpp.
249 : m_strName(str_Name.c_str())
250 , m_str_Value(str_Value)
253 , m_str_ValueBackup(str_Value)
255 , m_bValueBackup(
false)
258 , m_Access(theAccess)
261 if (m_str_Value.empty()) m_str_Value =
"";
262 if (m_str_ValueBackup.empty()) m_str_ValueBackup =
"";
opentxs::OTVariable::~OTVariable |
( |
| ) |
|
|
virtual |
Definition at line 295 of file OTVariable.cpp.
297 if (
nullptr != m_pScript) {
EXPORT void RemoveVariable(OTVariable &theVar)
bool opentxs::OTVariable::Compare |
( |
OTVariable & |
rhs | ) |
|
Definition at line 438 of file OTVariable.cpp.
441 otOut <<
"OTVariable::Compare: Names don't match: " <<
GetName()
442 <<
" / " << rhs.GetName() <<
" \n";
445 if (!(
GetType() == rhs.GetType())) {
446 otOut <<
"OTVariable::Compare: Type doesn't match: " <<
GetName()
451 otOut <<
"OTVariable::Compare: Access types don't match: " <<
GetName()
469 otErr <<
"OTVariable::Compare: Unknown type in variable " << m_strName
OTVariable_Type GetType() const
OTLOG_IMPORT OTLogStream otOut
EXPORT const OTString & GetName() const
OTVariable_Access GetAccess() const
OTLOG_IMPORT OTLogStream otErr
std::string & GetValueString()
int32_t & GetValueInteger()
bool Compare(OTVariable &rhs)
bool opentxs::OTVariable::CopyValueBool |
( |
| ) |
const |
|
inline |
int32_t opentxs::OTVariable::CopyValueInteger |
( |
| ) |
const |
|
inline |
std::string opentxs::OTVariable::CopyValueString |
( |
| ) |
const |
|
inline |
EXPORT const OTString& opentxs::OTVariable::GetName |
( |
| ) |
const |
|
inline |
bool& opentxs::OTVariable::GetValueBool |
( |
| ) |
|
|
inline |
int32_t& opentxs::OTVariable::GetValueInteger |
( |
| ) |
|
|
inline |
std::string& opentxs::OTVariable::GetValueString |
( |
| ) |
|
|
inline |
bool opentxs::OTVariable::IsBool |
( |
| ) |
const |
|
inline |
bool opentxs::OTVariable::IsConstant |
( |
| ) |
const |
|
inline |
bool opentxs::OTVariable::IsDirty |
( |
| ) |
const |
Definition at line 353 of file OTVariable.cpp.
355 bool bReturnVal =
false;
359 if (0 != m_str_Value.compare(m_str_ValueBackup))
375 otErr <<
"OTVariable::IsDirty: Error: unknown type for variable: "
376 << m_strName <<
"\n";
OTLOG_IMPORT OTLogStream otErr
bool opentxs::OTVariable::IsImportant |
( |
| ) |
const |
|
inline |
bool opentxs::OTVariable::IsInteger |
( |
| ) |
const |
|
inline |
bool opentxs::OTVariable::IsPersistent |
( |
| ) |
const |
|
inline |
bool opentxs::OTVariable::IsString |
( |
| ) |
const |
|
inline |
void opentxs::OTVariable::RegisterForExecution |
( |
OTScript & |
theScript | ) |
|
Definition at line 424 of file OTVariable.cpp.
428 const std::string str_var_name = m_strName.
Get();
430 theScript.AddVariable(str_var_name, *
this);
432 m_pScript = &theScript;
EXPORT const char * Get() const
void opentxs::OTVariable::Serialize |
( |
OTString & |
strAppend, |
|
|
bool |
bCalculatingID = false |
|
) |
| const |
Definition at line 144 of file OTVariable.cpp.
147 std::string str_access(
"");
152 str_access =
"constant";
156 str_access =
"persistent";
160 str_access =
"important";
163 otErr <<
"OTVariable::Serialize: ERROR: Bad variable type.\n";
167 std::string str_type;
173 if ((
false == bCalculatingID) &&
175 (m_str_Value.size() > 0))
178 OTString strVal(m_str_Value.c_str());
179 OTASCIIArmor ascVal(strVal);
180 strAppend.Concatenate(
"<variable\n name=\"%s\"\n"
183 " access=\"%s\" >\n%s</variable>\n\n",
184 m_strName.
Get(),
"exists", str_type.c_str(),
185 str_access.c_str(), ascVal.Get());
188 strAppend.Concatenate(
"<variable\n name=\"%s\"\n"
191 " access=\"%s\" />\n\n",
192 m_strName.
Get(),
"none",
193 str_type.c_str(), str_access.c_str());
197 str_type =
"integer";
198 strAppend.Concatenate(
199 "<variable\n name=\"%s\"\n"
202 " access=\"%s\" />\n\n",
204 bCalculatingID ? 0 : m_nValue,
207 str_type.c_str(), str_access.c_str());
211 strAppend.Concatenate(
212 "<variable\n name=\"%s\"\n"
215 " access=\"%s\" />\n\n",
219 : (m_bValue ?
"true" :
"false"),
228 <<
"OTVariable::Serialize: Error, Wrong Type -- not serializing.\n";
EXPORT const char * Get() const
OTLOG_IMPORT OTLogStream otErr
void opentxs::OTVariable::SetAsClean |
( |
| ) |
|
Definition at line 385 of file OTVariable.cpp.
389 m_str_ValueBackup = m_str_Value;
394 m_nValueBackup = m_nValue;
399 m_bValueBackup = m_bValue;
404 otErr <<
"OTVariable::SetAsClean: Error: unknown type for variable: "
405 << m_strName <<
"\n";
406 m_str_ValueBackup = m_str_Value;
407 m_nValueBackup = m_nValue;
408 m_bValueBackup = m_bValue;
OTLOG_IMPORT OTLogStream otErr
void opentxs::OTVariable::SetBylaw |
( |
OTBylaw & |
theBylaw | ) |
|
|
inline |
bool opentxs::OTVariable::SetValue |
( |
const int32_t & |
nValue | ) |
|
Definition at line 307 of file OTVariable.cpp.
310 otErr <<
"OTVariable::SetValue(int64_t): Error: This variable ("
311 << m_strName <<
") is not an integer.\n";
315 m_nValue = m_nValueBackup = nValue;
OTLOG_IMPORT OTLogStream otErr
bool opentxs::OTVariable::SetValue |
( |
bool |
bValue | ) |
|
Definition at line 320 of file OTVariable.cpp.
323 otErr <<
"OTVariable::SetValue(bool): Error: This variable ("
324 << m_strName <<
") is not a bool.\n";
328 m_bValue = m_bValueBackup = bValue;
OTLOG_IMPORT OTLogStream otErr
bool opentxs::OTVariable::SetValue |
( |
const std::string & |
str_Value | ) |
|
Definition at line 333 of file OTVariable.cpp.
336 otErr <<
"OTVariable::SetValue(std::string): Error: This variable ("
337 << m_strName <<
") is not a string.\n";
341 m_str_Value = m_str_ValueBackup = str_Value;
343 if (m_str_Value.empty()) m_str_Value =
"";
344 if (m_str_ValueBackup.empty()) m_str_ValueBackup =
"";
OTLOG_IMPORT OTLogStream otErr
void opentxs::OTVariable::UnregisterScript |
( |
| ) |
|
The documentation for this class was generated from the following files: