3DCoat
3D-COAT 4.9.xx
3DCoat is the one application that has all the tools you need to take your 3D idea from a block of digital clay all the way to a production ready, fully textured organic or hard surface model.
|
This class intended to load/save the class derived from the BaseClass as XML/JSON. But it may be used just for XML/JSON load/save. Pay attention, attributes of the XML not supported. More...
#include <TagsList.h>
Public Member Functions | |
int | to_int () const |
convert tag value to int More... | |
float | to_float () const |
convert tag value to float More... | |
bool | to_bool () const |
convert tag value to bool More... | |
const char * | to_string () const |
get value of the tag More... | |
float | to_float () |
get value of the tag as float More... | |
int | get_data (void *buffer, int maxlength) |
get value of the tag as the data array, returns the actual data length More... | |
int | GetTagsFromString (const char *XMLSource) |
convert string to the tags structure More... | |
int | PutTagsIntoString (comms::cStr *To, int shift=0) |
convert tags structure to the string More... | |
int | GetTagsFromJsonString (const char *jsonSource) |
convert string to the tags structure More... | |
int | PutTagsIntoJsonString (comms::cStr *Source, int shift=0) |
convert tags structure to the string More... | |
bool | ReadTagsFromFile (const char *FilePath) |
read tags from file More... | |
void | WriteTagsToFile (const char *FilePath, bool OnlyChanged=false) |
save tags to file More... | |
void | Assign (int v) |
assign int value to the tag value More... | |
void | Assign (const char *s) |
assign string value to the tag More... | |
TagsList * | AddSubTag (TagsList *SubQ) |
Add already allocated tag to the tags list within this tag. More... | |
TagsList * | AddSubTag (const char *quotename, const char *body="") |
Add new tag to the tags list within this tag. More... | |
TagsList * | AddSubTag (const char *quotename, int body) |
Add new tag with integer value to the tags list within this tag. More... | |
TagsList * | AddSubTag (const char *quotename, float body) |
Add new tag with the floating point value. More... | |
TagsList * | AddSubTag (const char *quotename, void *data, int Length) |
Add new tag with the data array. More... | |
TagsList & | operator<< (const char *string) |
add tags using << operator. Add tag name (should start with # sign), then pass the value. Tags names will be treated without the # sign. Example: tags << "#x" << x << "#name" << name; You may pass values without tags, then tags names will be treated as empty More... | |
template<class X > | |
TagsList & | operator<< (const cList< X > &array) |
store the list of simple elements. Elements should consist of simple types. Pointers, virtual functions or nontrivial constructors strictly prohibited there! This is intended to keep simple arrays of values, vectors etc. More... | |
template<typename X , typename TYPE > | |
void | StoreField (const char *tagname, const cList< X > &array, TYPE X::*member) |
void | operator>> (comms::cStr &string_value) |
read values from the tags list More... | |
template<class X > | |
void | operator>> (cList< X > &array) |
restore simple list, the size of the element should be the same as ou stored More... | |
template<typename X , typename TYPE > | |
void | RestoreField (cList< X > &array, TYPE X::*member) |
This template is complimentary to the StoreField. It allows to restore previously stored field of the structure. See the StoreField description. More... | |
void | bin_ToBS (BinStream &BS) |
save to the binary stream in the binary form, see the implementation for the data format specification More... | |
void | text_ToBS (BinStream &BS) |
save to the binary stream in the textual (XML) form More... | |
bool | FromBS (BinStream &BS) |
load in binary or text form More... | |
TagsList * | GetSubTag (int Index) |
Get sub-tag by index. More... | |
TagsList * | elem (int Index) |
returns the reference to the element. Pay attention, it may return the zero reference! Anyway, it may be useful for operations like T->elem(i) >> x. It works even it the element i-th does not exist, in this case x will be just cleared. More... | |
TagsList * | operator[] (int Index) |
Should return pointer (not reference) because of optimization error in clang/LLVM. More... | |
TagsList * | GetSubTag (const char *SubQuoteName) |
Get sub-tag by name. More... | |
TagsList * | elem (const char *SubQuoteName) |
returns the reference to the element. Pay attention, it may return the zero reference! Anyway, it may be useful for operations like T->elem("X") >> x. It works even it the element "X" does not exist, in this case x will be just cleared. More... | |
TagsList * | operator[] (const char *SubQuoteName) |
Should return pointer (not reference) because of optimization error in clang/LLVM. More... | |
int | GetSubTagsCount () |
Get amount of sub-tags. More... | |
int | length () |
Get amount of sub-tags, same as previous, js-like. More... | |
void | RemoveSubTag (int idx) |
Remove sub-tag by index. More... | |
TagsList * | RemoveAndGetSubTag (int idx) |
Remove and return tag by index. The return value will not be destroyed, you should do it later by yourself. More... | |
const char * | GetTagName () |
returns this tag name More... | |
void | SetTagName (const char *Name) |
set name for the current tag. If this tag was already used somewhere, the memory will not be allocated for the name. More... | |
void | FreeTag () |
free all memory associated with this tag More... | |
void | operator= (TagsList &src) |
copy More... | |
Static Public Member Functions | |
static const char * | GetConstantLocation (const char *str) |
This function returns constant location for the input string. Even if the input string will be destroyed later, the return value will be kept till the program termination. More... | |
static const char * | GetConstantSubstringLocation (const char *str, int Len, int **value=nullptr) |
This function returns constant location for the input sub - string (max length = Len). Even if the input string will be destroyed later, the return value will be kept till the program termination. More... | |
Static Public Attributes | |
static comms::cStr | LastTagFile |
last saved/loaded file with tags More... | |
This class intended to load/save the class derived from the BaseClass as XML/JSON. But it may be used just for XML/JSON load/save. Pay attention, attributes of the XML not supported.
Add already allocated tag to the tags list within this tag.
Referenced by ExampleOfLoadSaveDataTo3BFileExtension::SaveData(), and StoreField().
TagsList* TagsList::AddSubTag | ( | const char * | quotename, |
const char * | body = "" |
||
) |
Add new tag to the tags list within this tag.
TagsList* TagsList::AddSubTag | ( | const char * | quotename, |
int | body | ||
) |
Add new tag with integer value to the tags list within this tag.
TagsList* TagsList::AddSubTag | ( | const char * | quotename, |
float | body | ||
) |
Add new tag with the floating point value.
TagsList* TagsList::AddSubTag | ( | const char * | quotename, |
void * | data, | ||
int | Length | ||
) |
Add new tag with the data array.
void TagsList::Assign | ( | int | v | ) |
assign int value to the tag value
Referenced by KnotReference::Save().
void TagsList::Assign | ( | const char * | s | ) |
assign string value to the tag
void TagsList::bin_ToBS | ( | BinStream & | BS | ) |
save to the binary stream in the binary form, see the implementation for the data format specification
Referenced by ExampleOfLoadSaveDataTo3BFileExtension::SaveData().
TagsList* TagsList::elem | ( | int | Index | ) |
returns the reference to the element. Pay attention, it may return the zero reference! Anyway, it may be useful for operations like T->elem(i) >> x. It works even it the element i-th does not exist, in this case x will be just cleared.
Referenced by ExampleOfLoadSaveDataTo3BFileExtension::LoadData().
TagsList* TagsList::elem | ( | const char * | SubQuoteName | ) |
returns the reference to the element. Pay attention, it may return the zero reference! Anyway, it may be useful for operations like T->elem("X") >> x. It works even it the element "X" does not exist, in this case x will be just cleared.
void TagsList::FreeTag | ( | ) |
free all memory associated with this tag
bool TagsList::FromBS | ( | BinStream & | BS | ) |
load in binary or text form
Referenced by ExampleOfLoadSaveDataTo3BFileExtension::LoadData().
int TagsList::get_data | ( | void * | buffer, |
int | maxlength | ||
) |
get value of the tag as the data array, returns the actual data length
|
static |
This function returns constant location for the input string. Even if the input string will be destroyed later, the return value will be kept till the program termination.
Referenced by BaseClassElement::fill().
|
static |
This function returns constant location for the input sub - string (max length = Len). Even if the input string will be destroyed later, the return value will be kept till the program termination.
TagsList* TagsList::GetSubTag | ( | int | Index | ) |
Get sub-tag by index.
TagsList* TagsList::GetSubTag | ( | const char * | SubQuoteName | ) |
Get sub-tag by name.
int TagsList::GetSubTagsCount | ( | ) |
Get amount of sub-tags.
const char* TagsList::GetTagName | ( | ) |
returns this tag name
int TagsList::GetTagsFromJsonString | ( | const char * | jsonSource | ) |
convert string to the tags structure
int TagsList::GetTagsFromString | ( | const char * | XMLSource | ) |
convert string to the tags structure
int TagsList::length | ( | ) |
Get amount of sub-tags, same as previous, js-like.
TagsList& TagsList::operator<< | ( | const char * | string | ) |
add tags using << operator. Add tag name (should start with # sign), then pass the value. Tags names will be treated without the # sign. Example: tags << "#x" << x << "#name" << name; You may pass values without tags, then tags names will be treated as empty
store the list of simple elements. Elements should consist of simple types. Pointers, virtual functions or nontrivial constructors strictly prohibited there! This is intended to keep simple arrays of values, vectors etc.
void TagsList::operator= | ( | TagsList & | src | ) |
copy
void TagsList::operator>> | ( | comms::cStr & | string_value | ) |
read values from the tags list
void TagsList::operator>> | ( | cList< X > & | array | ) |
restore simple list, the size of the element should be the same as ou stored
TagsList* TagsList::operator[] | ( | int | Index | ) |
Should return pointer (not reference) because of optimization error in clang/LLVM.
TagsList* TagsList::operator[] | ( | const char * | SubQuoteName | ) |
Should return pointer (not reference) because of optimization error in clang/LLVM.
int TagsList::PutTagsIntoJsonString | ( | comms::cStr * | Source, |
int | shift = 0 |
||
) |
convert tags structure to the string
Referenced by gltf::gModel::toJson().
int TagsList::PutTagsIntoString | ( | comms::cStr * | To, |
int | shift = 0 |
||
) |
convert tags structure to the string
bool TagsList::ReadTagsFromFile | ( | const char * | FilePath | ) |
read tags from file
TagsList* TagsList::RemoveAndGetSubTag | ( | int | idx | ) |
Remove and return tag by index. The return value will not be destroyed, you should do it later by yourself.
void TagsList::RemoveSubTag | ( | int | idx | ) |
Remove sub-tag by index.
void TagsList::RestoreField | ( | cList< X > & | array, |
TYPE X::* | member | ||
) |
This template is complimentary to the StoreField. It allows to restore previously stored field of the structure. See the StoreField description.
Referenced by ExampleOfLoadSaveDataTo3BFileExtension::LoadData().
void TagsList::SetTagName | ( | const char * | Name | ) |
set name for the current tag. If this tag was already used somewhere, the memory will not be allocated for the name.
Referenced by CurvePrimitive::OnChangeMember().
void TagsList::StoreField | ( | const char * | tagname, |
const cList< X > & | array, | ||
TYPE X::* | member | ||
) |
This template allows to store the given field of the array into the TagsList It is helpful if you need to store separate fields of some complex structure thta may not be serialized as a whole Example: you need to store Vector3D::x into the list -
References AddSubTag().
Referenced by ExampleOfLoadSaveDataTo3BFileExtension::SaveData().
void TagsList::text_ToBS | ( | BinStream & | BS | ) |
save to the binary stream in the textual (XML) form
bool TagsList::to_bool | ( | ) | const |
convert tag value to bool
float TagsList::to_float | ( | ) | const |
convert tag value to float
float TagsList::to_float | ( | ) |
get value of the tag as float
int TagsList::to_int | ( | ) | const |
convert tag value to int
const char* TagsList::to_string | ( | ) | const |
get value of the tag
Referenced by KnotReference::Load().
void TagsList::WriteTagsToFile | ( | const char * | FilePath, |
bool | OnlyChanged = false |
||
) |
save tags to file
|
static |
last saved/loaded file with tags