32 #ifndef VLXSerializer_INCLUDE_ONCE 33 #define VLXSerializer_INCLUDE_ONCE 50 typedef enum { NoError, ImportError, ExportError, ReadError, WriteError }
EError;
58 const char* errorString()
const;
80 bool canExport(
const Object* obj)
const;
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 String& str);
145 void signalExportError(
const 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;
185 std::map< ref<VLXStructure>,
ref<Object> > mImportedStructures;
187 std::map< std::string, VLXValue > mMetadata;
void setError(EError err)
Sets a serialization error.
VLCORE_EXPORT VLXRegistry * defVLXRegistry()
VLXRegistry * registry()
The VLXRegistry used by the serializer, by default set to vl::defVLXRegistry().
An abstract class representing a file.
std::map< std::string, VLXValue > & metadata()
The metadata to be imported or exported.
The String class implements an advanced UTF16 (Unicode BMP) string manipulation engine.
const VLXValue * getMetadata(const char *key) const
Returns the value of the given metadata key or NULL if no such metadata was found.
void setDirective(const char *directive, const char *value)
Sets a serialization directive that can be used by VLXClassWrapper objects to program the serializati...
void setDocumentURL(const String &location)
The URL of the document used to resolve document-relative file paths.
VLGRAPHICS_EXPORT bool saveVLT(VirtualFile *file, const ResourceDatabase *)
VLGRAPHICS_EXPORT ref< ResourceDatabase > loadVLB(VirtualFile *file)
VLGRAPHICS_EXPORT ref< ResourceDatabase > loadVLT(VirtualFile *file)
#define VL_INSTRUMENT_CLASS(ClassName, BaseClass)
EError error() const
The last signaled error.
const String & documentURL() const
The URL of the document used to resolve document-relative file paths.
Visualization Library main namespace.
void eraseDirective(const char *directive)
Removes a serialization directive.
The base class for all the reference counted objects.
const std::string & directive(const char *directive) const
Returns the value of a serialization directive.
bool hasDirective(const char *directive)
Returns true if the given directive has been set.
void eraseAllDirectives()
Erases all previously set directives.
Wrapper for all VLX value types.
const std::map< std::string, VLXValue > & metadata() const
The metadata to be imported or exported.
void setRegistry(const VLXRegistry *registry)
The VLXRegistry used by the serializer, by default set to vl::defVLXRegistry().
VLXValue * getMetadata(const char *key)
Returns the value of the given metadata key or NULL if no such metadata was found.
Registry of vl::VLXClassWrapper objects, used by vl::VLXSerializer, see also vl::defVLXRegistry().
The ref<> class is used to reference-count an Object.
VLGRAPHICS_EXPORT bool saveVLB(VirtualFile *file, const ResourceDatabase *)
A list of key/VLXValue pairs, can also have a tag.
Translates an arbitrary set of vl::Object (and subclasses) into VLB and VLT format.
const VLXRegistry * registry() const
The VLXRegistry used by the serializer, by default set to vl::defVLXRegistry().