![]() |
Safir SDK Core
|
Namespaces | |
namespace | TypeUtilities |
Classes | |
class | BlobReader |
This class is used to unpack and read blobs created by the BlobWriter class. More... | |
class | BlobWriter |
This class is used to create blobs by writing member values and the finally calling the CopyRawBlob-method. More... | |
class | ClassDescription |
Description of a class type. More... | |
class | CreateRoutineDescription |
Description of a create routine. More... | |
class | EnumDescription |
Description of an enumeration type. More... | |
class | ExceptionDescription |
Description of an exception type. More... | |
class | MemberDescription |
Description of a member. More... | |
class | MemberMappingDescription |
Description of a property member mapping. More... | |
class | ParameterDescription |
Description of a parameter. More... | |
class | ParseError |
Exception used to report errors in dou- and dom- files. More... | |
class | PropertyDescription |
Description of a property type. More... | |
class | PropertyMappingDescription |
Description of a property mapping. More... | |
class | TypeRepository |
The TypeRepository class is the baseclass of any TypeRepository implementation. More... | |
struct | TypeRepositoryTraits |
struct | TypeRepositoryTraits< TypeRepository > |
TypeTraits used to deduce specific types when TypeRepository is used in template code. More... | |
Functions | |
void | BinaryToBase64 (const char *binary, size_t size, std::ostringstream &base64) |
Encodes binary data to base64. | |
void | Base64ToBinary (const std::string &base64Str, std::vector< char > &binary) |
Decodes base64 data into binary data. | |
template<class RepositoryT > | |
void | BinaryToXml (const RepositoryT *repository, const char *blob, std::ostringstream &xml) |
Serializes binary representation of an object to xml. | |
template<class RepositoryT > | |
void | XmlToBinary (const RepositoryT *repository, const char *xml, std::vector< char > &binary) |
Converts a xml representation of an object to binary form. | |
template<class RepositoryT > | |
void | BinaryToJson (const RepositoryT *repository, const char *blob, std::ostringstream &json) |
Serializes binary representation of an object to json. | |
template<class RepositoryT > | |
void | JsonToBinary (const RepositoryT *repository, const char *json, std::vector< char > &binary) |
Converts a json representation of an object to binary form. | |
template<class RepositoryT > | |
void | RepositoryToString (const RepositoryT *repository, bool includeCreateRoutines, std::ostream &os) |
Writes a complete text description of a type repository and all of its content. | |
template<class RepositoryT > | |
void | TypeToString (const RepositoryT *repository, DotsC_TypeId typeId, std::ostream &os) |
Writes a complete text description of a type. | |
static void | GetFilesFromRootDirectories (const std::vector< boost::filesystem::path > &roots, std::vector< boost::filesystem::path > &douFiles, std::vector< boost::filesystem::path > &domFiles) |
Extract all files from the given root folders separated as dou- and dom- files. | |
static std::shared_ptr< const TypeRepository > | ParseTypeDefinitions (const std::vector< boost::filesystem::path > &roots) |
Will validate and parse a complete set of dou- and dom-files. | |
static std::shared_ptr< const TypeRepository > | ParseTypeDefinitions (const boost::filesystem::path &root) |
Will validate and parse a complete set of dou- and dom-files from If no error occurs, the result is returned. | |
void Safir::Dob::Typesystem::ToolSupport::Base64ToBinary | ( | const std::string & | base64Str, |
std::vector< char > & | binary ) |
Decodes base64 data into binary data.
base64Str | [in] - String containing a valid base64 string. |
binary | [out] - Binary result of conversion. |
Safir::Dob::Typesystem::Parser:ParseError | if anything goes wrong. For example if base64Str is not well-formed. |
void Safir::Dob::Typesystem::ToolSupport::BinaryToBase64 | ( | const char * | binary, |
size_t | size, | ||
std::ostringstream & | base64 ) |
Encodes binary data to base64.
binary | [in] - Pointer to binary data to be encoded. |
size | [in] - Size of binary data in bytes. |
base64 | [out] - Base64 encoded result. |
Safir::Dob::Typesystem::Parser:ParseError | if anything goes wrong. |
void Safir::Dob::Typesystem::ToolSupport::BinaryToJson | ( | const RepositoryT * | repository, |
const char * | blob, | ||
std::ostringstream & | json ) |
Serializes binary representation of an object to json.
repository | [in] - Type repository containing needed type information. |
blob | [in] - Binary data to be converted. |
json | [out] - Json result of conversion. |
Safir::Dob::Typesystem::Parser:ParseError | if binary can't be serialized to json. |
void Safir::Dob::Typesystem::ToolSupport::BinaryToXml | ( | const RepositoryT * | repository, |
const char * | blob, | ||
std::ostringstream & | xml ) |
Serializes binary representation of an object to xml.
repository | [in] - Type repository containing needed type information. |
blob | [in] - Binary data to be converted. |
xml | [out] - Xml result of conversion. |
Safir::Dob::Typesystem::Parser:ParseError | if binary can't be serialized to xml. |
|
static |
Extract all files from the given root folders separated as dou- and dom- files.
The resulting file lists can contain duplicates, i.e overrides that must be handled later on.
roots | [in] - A vector of root directories containing dou- and dom-files. |
douFiles | [out] - A vector where all dou-filepaths found in roots will be inserted. |
domFiles | [out] - A vector where all dom-filepaths found in roots will be inserted. |
Safir::Dob::Typesystem::Parser:ParseError | The dou- or dom- files at the specified path contains errors. |
Referenced by ParseTypeDefinitions().
void Safir::Dob::Typesystem::ToolSupport::JsonToBinary | ( | const RepositoryT * | repository, |
const char * | json, | ||
std::vector< char > & | binary ) |
Converts a json representation of an object to binary form.
repository | [in] - Type repository containing needed type information. |
json | [in] - Json serialized object. |
binary | [out] - Resulting binary data. |
Safir::Dob::Typesystem::Parser:ParseError | if json can't be serialized to a binary. |
|
static |
Will validate and parse a complete set of dou- and dom-files from If no error occurs, the result is returned.
The root path will be parsed recursively, i.e any subfolders will be parsed too.
root | [in] - Root directory path to location of dou- and dom-files that shall be parsed. |
Safir::Dob::Typesystem::Parser:ParseError | The dou- or dom- files at the specified path contains errors. |
References ParseTypeDefinitions().
|
static |
Will validate and parse a complete set of dou- and dom-files.
If no error occurs, the result is returned. This version takes a vector of paths and each path is traversed recursively including subfolders. If the same dou-/dom- file exists at many paths the latest found will override the previous ones. I.e files found at paths closer to the end of the vector will override files closer to the beginning of the vector.
roots | [in] - A vector of root directories containing dou- and dom-files that shall be parsed. |
Safir::Dob::Typesystem::Parser:ParseError | The dou- or dom- files at the specified path contains errors. |
References GetFilesFromRootDirectories().
Referenced by ParseTypeDefinitions().
void Safir::Dob::Typesystem::ToolSupport::RepositoryToString | ( | const RepositoryT * | repository, |
bool | includeCreateRoutines, | ||
std::ostream & | os ) |
Writes a complete text description of a type repository and all of its content.
This function is primarily intended for debugging. It can be used to compare if two repositiories are identical.
Since CreateRoutines are only used for code generation and not needed for a repository to be fully functional the caller must choose if CreateRoutins are to be included in the output. The reason is that it shall be possible to compare outputs from two repositories where only one of them contains CreateRoutine information.
repository | [in] - Type repository to convert to text. |
includeCreateRoutines | [in] - If true CreateRoutines will also be written to the output. |
os | [out] - Output stream. For example a ostringstream or cout. |
References RepositoryToString().
Referenced by RepositoryToString().
void Safir::Dob::Typesystem::ToolSupport::TypeToString | ( | const RepositoryT * | repository, |
DotsC_TypeId | typeId, | ||
std::ostream & | os ) |
Writes a complete text description of a type.
If typeId refers to a class, CreateRoutines will be omitted.
repository | [in] - Type repository containing all type information. |
typeId | [in] - The type to convert to text. |
os | [out] - Output stream. For example a ostringstream or cout. |
void Safir::Dob::Typesystem::ToolSupport::XmlToBinary | ( | const RepositoryT * | repository, |
const char * | xml, | ||
std::vector< char > & | binary ) |
Converts a xml representation of an object to binary form.
repository | [in] - Type repository containing needed type information. |
xml | [in] - Xml serialized object. |
binary | [out] - Resulting binary data. |
Safir::Dob::Typesystem::Parser:ParseError | if xml can't be serialized to a binary. |