Visualization Library v1.0.3

A lightweight C++ OpenGL middleware for 2D/3D graphics

VL     Star     Watch     Fork     Issue

[Download] [Tutorials] [All Classes] [Grouped Classes]
Public Types | Public Member Functions

vl::VLXSerializer Class Reference

Translates an arbitrary set of vl::Object (and subclasses) into VLB and VLT format. More...

#include <VLXSerializer.hpp>

Inheritance diagram for vl::VLXSerializer:
vl::Object

List of all members.

Public Types

enum  EError {
  NoError, ImportError, ExportError, ReadError,
  WriteError
}

Public Member Functions

 VLXSerializer ()
const char * errorString () const
bool saveVLT (const String &path, const Object *obj, bool start_fresh=true)
bool saveVLT (VirtualFile *file, const Object *obj, bool start_fresh=true)
bool saveVLB (const String &path, const Object *obj, bool start_fresh=true)
bool saveVLB (VirtualFile *file, const Object *obj, bool start_fresh=true)
ref< ObjectloadVLT (const String &path, bool start_fresh=true)
ref< ObjectloadVLT (VirtualFile *file, bool start_fresh=true)
ref< ObjectloadVLB (const String &path, bool start_fresh=true)
ref< ObjectloadVLB (VirtualFile *file, bool start_fresh=true)
ObjectimportVLX (const VLXStructure *st)
VLXStructureexportVLX (const Object *obj)
bool canExport (const Object *obj) const
bool canImport (const VLXStructure *st) const
void registerImportedStructure (const VLXStructure *st, Object *obj)
void registerExportedObject (const Object *obj, VLXStructure *st)
ObjectgetImportedStructure (const VLXStructure *st)
VLXStructuregetExportedObject (const Object *obj)
VLXRegistryregistry ()
 The VLXRegistry used by the serializer, by default set to vl::defVLXRegistry().
const VLXRegistryregistry () const
 The VLXRegistry used by the serializer, by default set to vl::defVLXRegistry().
void setRegistry (const VLXRegistry *registry)
 The VLXRegistry used by the serializer, by default set to vl::defVLXRegistry().
std::map< std::string, VLXValue > & metadata ()
 The metadata to be imported or exported.
const std::map< std::string,
VLXValue > & 
metadata () const
 The metadata to be imported or exported.
VLXValuegetMetadata (const char *key)
 Returns the value of the given metadata key or NULL if no such metadata was found.
const VLXValuegetMetadata (const char *key) const
 Returns the value of the given metadata key or NULL if no such metadata was found.
void reset ()
std::string generateID (const char *prefix)
void setError (EError err)
 Sets a serialization error.
EError error () const
 The last signaled error.
void signalImportError (const String &str)
void signalExportError (const String &str)
void setDocumentURL (const String &location)
 The URL of the document used to resolve document-relative file paths.
const StringdocumentURL () const
 The URL of the document used to resolve document-relative file paths.
void resolvePath (std::string &path)
 If the given path starts with "this:" then the "this:" prefix is replaced with the documentURL(), otherwise the path is left unchanged.
void setDirective (const char *directive, const char *value)
 Sets a serialization directive that can be used by VLXClassWrapper objects to program the serialization process.
void eraseDirective (const char *directive)
 Removes a serialization directive.
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.

Detailed Description

Translates an arbitrary set of vl::Object (and subclasses) into VLB and VLT format.

Definition at line 45 of file VLXSerializer.hpp.


Member Enumeration Documentation

Enumerator:
NoError 
ImportError 
ExportError 
ReadError 
WriteError 

Definition at line 50 of file VLXSerializer.hpp.


Constructor & Destructor Documentation

vl::VLXSerializer::VLXSerializer (  ) [inline]

Definition at line 53 of file VLXSerializer.hpp.

References vl::defVLXRegistry().


Member Function Documentation

const char * VLXSerializer::errorString (  ) const

Definition at line 426 of file VLXSeriailzer.cpp.

References ExportError, ImportError, NoError, ReadError, and WriteError.

Referenced by vl::loadVLB(), vl::loadVLT(), vl::saveVLB(), and vl::saveVLT().

bool VLXSerializer::saveVLT ( const String path,
const Object obj,
bool  start_fresh = true 
)

Definition at line 203 of file VLXSeriailzer.cpp.

References vl::ref< T >::get().

Referenced by vl::saveVLT().

bool VLXSerializer::saveVLT ( VirtualFile file,
const Object obj,
bool  start_fresh = true 
)
bool VLXSerializer::saveVLB ( const String path,
const Object obj,
bool  start_fresh = true 
)

Definition at line 274 of file VLXSeriailzer.cpp.

References vl::ref< T >::get().

Referenced by vl::saveVLB().

bool VLXSerializer::saveVLB ( VirtualFile file,
const Object obj,
bool  start_fresh = true 
)
ref< Object > VLXSerializer::loadVLT ( const String path,
bool  start_fresh = true 
)

Definition at line 338 of file VLXSeriailzer.cpp.

References vl::ref< T >::get(), and vl::locateFile().

Referenced by vl::loadVLT().

ref< Object > VLXSerializer::loadVLT ( VirtualFile file,
bool  start_fresh = true 
)
ref< Object > VLXSerializer::loadVLB ( const String path,
bool  start_fresh = true 
)

Definition at line 382 of file VLXSeriailzer.cpp.

References vl::ref< T >::get(), and vl::locateFile().

Referenced by vl::loadVLB().

ref< Object > VLXSerializer::loadVLB ( VirtualFile file,
bool  start_fresh = true 
)
Object * VLXSerializer::importVLX ( const VLXStructure st )
VLXStructure * VLXSerializer::exportVLX ( const Object obj )
bool VLXSerializer::canExport ( const Object obj ) const
bool VLXSerializer::canImport ( const VLXStructure st ) const
void VLXSerializer::registerImportedStructure ( const VLXStructure st,
Object obj 
)
void VLXSerializer::registerExportedObject ( const Object obj,
VLXStructure st 
)
Object * VLXSerializer::getImportedStructure ( const VLXStructure st )

Definition at line 152 of file VLXSeriailzer.cpp.

References NULL, and VL_CHECK.

Referenced by importVLX().

VLXStructure * VLXSerializer::getExportedObject ( const Object obj )

Definition at line 164 of file VLXSeriailzer.cpp.

References NULL, and VL_CHECK.

Referenced by exportVLX().

VLXRegistry* vl::VLXSerializer::registry (  ) [inline]

The VLXRegistry used by the serializer, by default set to vl::defVLXRegistry().

Definition at line 93 of file VLXSerializer.hpp.

Referenced by canExport(), canImport(), exportVLX(), and importVLX().

const VLXRegistry* vl::VLXSerializer::registry (  ) const [inline]

The VLXRegistry used by the serializer, by default set to vl::defVLXRegistry().

Definition at line 96 of file VLXSerializer.hpp.

void vl::VLXSerializer::setRegistry ( const VLXRegistry registry ) [inline]

The VLXRegistry used by the serializer, by default set to vl::defVLXRegistry().

Definition at line 99 of file VLXSerializer.hpp.

std::map< std::string, VLXValue >& vl::VLXSerializer::metadata (  ) [inline]

The metadata to be imported or exported.

Definition at line 102 of file VLXSerializer.hpp.

Referenced by loadVLB(), loadVLT(), saveVLB(), and saveVLT().

const std::map< std::string, VLXValue >& vl::VLXSerializer::metadata (  ) const [inline]

The metadata to be imported or exported.

Definition at line 105 of file VLXSerializer.hpp.

VLXValue* vl::VLXSerializer::getMetadata ( const char *  key ) [inline]

Returns the value of the given metadata key or NULL if no such metadata was found.

Definition at line 108 of file VLXSerializer.hpp.

References NULL.

const VLXValue* vl::VLXSerializer::getMetadata ( const char *  key ) const [inline]

Returns the value of the given metadata key or NULL if no such metadata was found.

Definition at line 118 of file VLXSerializer.hpp.

References NULL.

void vl::VLXSerializer::reset (  ) [inline]

Definition at line 127 of file VLXSerializer.hpp.

Referenced by loadVLB(), loadVLT(), saveVLB(), and saveVLT().

std::string VLXSerializer::generateID ( const char *  prefix )
void vl::VLXSerializer::setError ( EError  err ) [inline]
EError vl::VLXSerializer::error (  ) const [inline]
void VLXSerializer::signalImportError ( const String str )
void VLXSerializer::signalExportError ( const String str )
void vl::VLXSerializer::setDocumentURL ( const String location ) [inline]

The URL of the document used to resolve document-relative file paths.

Definition at line 148 of file VLXSerializer.hpp.

Referenced by loadVLB(), and loadVLT().

const String& vl::VLXSerializer::documentURL (  ) const [inline]

The URL of the document used to resolve document-relative file paths.

Definition at line 151 of file VLXSerializer.hpp.

Referenced by resolvePath().

void VLXSerializer::resolvePath ( std::string &  path )

If the given path starts with "this:" then the "this:" prefix is replaced with the documentURL(), otherwise the path is left unchanged.

Definition at line 439 of file VLXSeriailzer.cpp.

References documentURL(), vl::String::extractPath(), vl::String::fromStdString(), vl::String::normalizeSlashes(), vl::String::right(), vl::String::startsWith(), and vl::String::toStdString().

Referenced by vl::VLXClassWrapper_GLSLShader::importGLSLShader(), and vl::VLXClassWrapper_Texture::importTexture().

void vl::VLXSerializer::setDirective ( const char *  directive,
const char *  value 
) [inline]

Sets a serialization directive that can be used by VLXClassWrapper objects to program the serialization process.

Directives are essentially a way to pass options to VLXClassWrapper objects, which can read them from the VLXSerializer they are using.

Definition at line 158 of file VLXSerializer.hpp.

void vl::VLXSerializer::eraseDirective ( const char *  directive ) [inline]

Removes a serialization directive.

Definition at line 161 of file VLXSerializer.hpp.

const std::string& vl::VLXSerializer::directive ( const char *  directive ) const [inline]

Returns the value of a serialization directive.

Definition at line 164 of file VLXSerializer.hpp.

bool vl::VLXSerializer::hasDirective ( const char *  directive ) [inline]

Returns true if the given directive has been set.

Definition at line 175 of file VLXSerializer.hpp.

void vl::VLXSerializer::eraseAllDirectives (  ) [inline]

Erases all previously set directives.

Definition at line 178 of file VLXSerializer.hpp.


The documentation for this class was generated from the following files:

Visualization Library v1.0.3 Reference Documentation
Copyright Michele Bosi. All rights reserved.
Updated on Tue Feb 7 2017 00:55:08.
Permission is granted to use this page to write and publish articles regarding Visualization Library.