32 #ifndef VLXSerializer_INCLUDE_ONCE 33 #define VLXSerializer_INCLUDE_ONCE 50 typedef enum { NoError, ImportError, ExportError, ReadError, WriteError }
EError;
58 const char* errorString()
const;
84 void registerImportedStructure(
const VLXStructure* st, Object* obj);
102 std::map< std::string, VLXValue >&
metadata() {
return mMetadata; }
105 const std::map< std::string, VLXValue >&
metadata()
const {
return mMetadata; }
110 std::map< std::string, VLXValue >::iterator it = metadata().find(key);
111 if (it == metadata().end())
120 std::map< std::string, VLXValue >::const_iterator it = metadata().find(key);
121 if (it == metadata().end())
131 mImportedStructures.clear();
132 mExportedObjects.clear();
135 std::string generateID(
const char* prefix);
141 EError
error()
const {
return mError; }
143 void signalImportError(
const vl::String& str);
145 void signalExportError(
const vl::String& str);
154 void resolvePath(std::string& path);
158 void setDirective(
const char* directive,
const char* value) { mDirectives[directive] = value; }
164 const std::string&
directive(
const char* directive)
const 166 static const std::string no_directive =
"NO_SUCH_DIRECTIVE";
167 std::map<std::string, std::string>::const_iterator it = mDirectives.find(directive);
168 if (it != mDirectives.end())
175 bool hasDirective(
const char* directive) {
return mDirectives.find(directive) != mDirectives.end(); }
182 std::map<std::string, std::string> mDirectives;
187 std::map< std::string, VLXValue > mMetadata;
VLX_EXPORT bool saveVLT(vl::VirtualFile *file, const vl::ResourceDatabase *)
Wrapper for all VLX value types.
An abstract class representing a file.
VLXValue * getMetadata(const char *key)
Returns the value of the given metadata key or NULL if no such metadata was found.
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
const std::string & directive(const char *directive) const
Returns the value of a serialization directive.
Registry * registry()
The Registry used by the serializer, by default set to vl::defVLXRegistry().
VLX_EXPORT Registry * defVLXRegistry()
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
const VLXValue * getMetadata(const char *key) const
Returns the value of the given metadata key or NULL if no such metadata was found.
const std::map< std::string, VLXValue > & metadata() const
The metadata to be imported or exported.
bool hasDirective(const char *directive)
Returns true if the given directive has been set.
A list of key/VLXValue pairs, can also have a tag.
void setError(EError err)
Sets a serialization error.
std::map< std::string, VLXValue > & metadata()
The metadata to be imported or exported.
EError error() const
The last signaled error.
The base class for all the reference counted objects.
void eraseDirective(const char *directive)
Removes a serialization directive.
void setDirective(const char *directive, const char *value)
Sets a serialization directive that can be used by ClassWrapper objects to program the serialization ...
void eraseAllDirectives()
Erases all previously set directives.
void setDocumentURL(const vl::String &location)
The URL of the document used to resolve document-relative file paths.
VLX_EXPORT vl::ref< vl::ResourceDatabase > loadVLT(vl::VirtualFile *file)
Translates an arbitrary set of vl::Object (and subclasses) into VLB and VLT format.
Registry of vl::ClassWrapper objects, used by vl::VLXSerializer, see also vl::defVLXRegistry().
VLX_EXPORT bool saveVLB(vl::VirtualFile *file, const vl::ResourceDatabase *)
const Registry * registry() const
The Registry used by the serializer, by default set to vl::defVLXRegistry().
void setRegistry(const Registry *registry)
The Registry used by the serializer, by default set to vl::defVLXRegistry().
VLX_EXPORT vl::ref< vl::ResourceDatabase > loadVLB(vl::VirtualFile *file)
const vl::String & documentURL() const
The URL of the document used to resolve document-relative file paths.