Safir SDK Core
Loading...
Searching...
No Matches
Safir::Dob::Typesystem::ToolSupport Namespace Reference

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 TypeRepositoryParseTypeDefinitions (const std::vector< boost::filesystem::path > &roots)
 Will validate and parse a complete set of dou- and dom-files.
 
static std::shared_ptr< const TypeRepositoryParseTypeDefinitions (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.
 

Function Documentation

◆ Base64ToBinary()

void Safir::Dob::Typesystem::ToolSupport::Base64ToBinary ( const std::string & base64Str,
std::vector< char > & binary )

Decodes base64 data into binary data.

Parameters
base64Str[in] - String containing a valid base64 string.
binary[out] - Binary result of conversion.
Exceptions
Safir::Dob::Typesystem::Parser:ParseErrorif anything goes wrong. For example if base64Str is not well-formed.

◆ BinaryToBase64()

void Safir::Dob::Typesystem::ToolSupport::BinaryToBase64 ( const char * binary,
size_t size,
std::ostringstream & base64 )

Encodes binary data to base64.

Parameters
binary[in] - Pointer to binary data to be encoded.
size[in] - Size of binary data in bytes.
base64[out] - Base64 encoded result.
Exceptions
Safir::Dob::Typesystem::Parser:ParseErrorif anything goes wrong.

◆ BinaryToJson()

template<class RepositoryT >
void Safir::Dob::Typesystem::ToolSupport::BinaryToJson ( const RepositoryT * repository,
const char * blob,
std::ostringstream & json )

Serializes binary representation of an object to json.

Parameters
repository[in] - Type repository containing needed type information.
blob[in] - Binary data to be converted.
json[out] - Json result of conversion.
Exceptions
Safir::Dob::Typesystem::Parser:ParseErrorif binary can't be serialized to json.

◆ BinaryToXml()

template<class RepositoryT >
void Safir::Dob::Typesystem::ToolSupport::BinaryToXml ( const RepositoryT * repository,
const char * blob,
std::ostringstream & xml )

Serializes binary representation of an object to xml.

Parameters
repository[in] - Type repository containing needed type information.
blob[in] - Binary data to be converted.
xml[out] - Xml result of conversion.
Exceptions
Safir::Dob::Typesystem::Parser:ParseErrorif binary can't be serialized to xml.

◆ GetFilesFromRootDirectories()

static void Safir::Dob::Typesystem::ToolSupport::GetFilesFromRootDirectories ( const std::vector< boost::filesystem::path > & roots,
std::vector< boost::filesystem::path > & douFiles,
std::vector< boost::filesystem::path > & domFiles )
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.

Parameters
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.
Exceptions
Safir::Dob::Typesystem::Parser:ParseErrorThe dou- or dom- files at the specified path contains errors.

Referenced by ParseTypeDefinitions().

Here is the caller graph for this function:

◆ JsonToBinary()

template<class RepositoryT >
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.

Parameters
repository[in] - Type repository containing needed type information.
json[in] - Json serialized object.
binary[out] - Resulting binary data.
Exceptions
Safir::Dob::Typesystem::Parser:ParseErrorif json can't be serialized to a binary.

◆ ParseTypeDefinitions() [1/2]

static std::shared_ptr< const TypeRepository > Safir::Dob::Typesystem::ToolSupport::ParseTypeDefinitions ( const boost::filesystem::path & root)
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.

Parameters
root[in] - Root directory path to location of dou- and dom-files that shall be parsed.
Returns
TypeRepository containing all types, i.e classes, exceptions, enums, properties and property mappings.
Exceptions
Safir::Dob::Typesystem::Parser:ParseErrorThe dou- or dom- files at the specified path contains errors.

References ParseTypeDefinitions().

Here is the call graph for this function:

◆ ParseTypeDefinitions() [2/2]

static std::shared_ptr< const TypeRepository > Safir::Dob::Typesystem::ToolSupport::ParseTypeDefinitions ( const std::vector< boost::filesystem::path > & roots)
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.

Parameters
roots[in] - A vector of root directories containing dou- and dom-files that shall be parsed.
Returns
TypeRepository containing all types, i.e classes, exceptions, enums, properties and property mappings.
Exceptions
Safir::Dob::Typesystem::Parser:ParseErrorThe dou- or dom- files at the specified path contains errors.

References GetFilesFromRootDirectories().

Referenced by ParseTypeDefinitions().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RepositoryToString()

template<class RepositoryT >
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.

Parameters
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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ TypeToString()

template<class RepositoryT >
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.

Parameters
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.

◆ XmlToBinary()

template<class RepositoryT >
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.

Parameters
repository[in] - Type repository containing needed type information.
xml[in] - Xml serialized object.
binary[out] - Resulting binary data.
Exceptions
Safir::Dob::Typesystem::Parser:ParseErrorif xml can't be serialized to a binary.