Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
RemoteSchemaDocumentProvider< SchemaDocumentType > Class Template Reference
Inheritance diagram for RemoteSchemaDocumentProvider< SchemaDocumentType >:
Collaboration diagram for RemoteSchemaDocumentProvider< SchemaDocumentType >:

Public Member Functions

 RemoteSchemaDocumentProvider ()
 
 ~RemoteSchemaDocumentProvider ()
 
virtual const SchemaDocumentType * GetRemoteDocument (const char *uri, SizeType length)
 
- Public Member Functions inherited from IGenericRemoteSchemaDocumentProvider< SchemaDocument >
virtual ~IGenericRemoteSchemaDocumentProvider ()
 
virtual const SchemaDocumentGetRemoteDocument (const Ch *uri, SizeType length)=0
 

Additional Inherited Members

- Public Types inherited from IGenericRemoteSchemaDocumentProvider< SchemaDocument >
typedef SchemaDocument::Ch Ch
 

Detailed Description

template<typename SchemaDocumentType = SchemaDocument>
class RemoteSchemaDocumentProvider< SchemaDocumentType >

Definition at line 1702 of file schematest.cpp.

Constructor & Destructor Documentation

◆ RemoteSchemaDocumentProvider()

template<typename SchemaDocumentType = SchemaDocument>
RemoteSchemaDocumentProvider< SchemaDocumentType >::RemoteSchemaDocumentProvider ( )
inline

Definition at line 1704 of file schematest.cpp.

1704 :
1705 documentAllocator_(documentBuffer_, sizeof(documentBuffer_)),
1706 schemaAllocator_(schemaBuffer_, sizeof(schemaBuffer_))
1707 {
1708 const char* filenames[kCount] = {
1709 "jsonschema/remotes/integer.json",
1710 "jsonschema/remotes/subSchemas.json",
1711 "jsonschema/remotes/folder/folderInteger.json",
1712 "draft-04/schema"
1713 };
1714 const char* uris[kCount] = {
1715 "http://localhost:1234/integer.json",
1716 "http://localhost:1234/subSchemas.json",
1717 "http://localhost:1234/folder/folderInteger.json",
1718 "http://json-schema.org/draft-04/schema"
1719 };
1720
1721 for (size_t i = 0; i < kCount; i++) {
1722 sd_[i] = 0;
1723
1724 char jsonBuffer[8192];
1725 MemoryPoolAllocator<> jsonAllocator(jsonBuffer, sizeof(jsonBuffer));
1726 char* json = ReadFile(filenames[i], jsonAllocator);
1727 if (!json) {
1728 printf("json remote file %s not found", filenames[i]);
1729 ADD_FAILURE();
1730 }
1731 else {
1732 char stackBuffer[4096];
1733 MemoryPoolAllocator<> stackAllocator(stackBuffer, sizeof(stackBuffer));
1734 DocumentType d(&documentAllocator_, 1024, &stackAllocator);
1735 d.Parse(json);
1736 sd_[i] = new SchemaDocumentType(d, uris[i], static_cast<SizeType>(strlen(uris[i])), 0, &schemaAllocator_);
1738 }
1739 };
1740 }
Default memory allocator used by the parser and DOM.
Definition allocators.h:115
static void Free(void *ptr)
Frees a memory block (concept Allocator)
Definition allocators.h:238
#define ADD_FAILURE()
Definition gtest.h:1844
LOGGING_API void printf(Category category, const char *format,...)
Definition Logging.cpp:30
RAPIDJSON_NAMESPACE_BEGIN typedef unsigned SizeType
Size type (for string lengths, array sizes, etc.)
Definition rapidjson.h:384
CK_ULONG d
Here is the call graph for this function:

◆ ~RemoteSchemaDocumentProvider()

template<typename SchemaDocumentType = SchemaDocument>
RemoteSchemaDocumentProvider< SchemaDocumentType >::~RemoteSchemaDocumentProvider ( )
inline

Definition at line 1742 of file schematest.cpp.

1742 {
1743 for (size_t i = 0; i < kCount; i++)
1744 delete sd_[i];
1745 }

Member Function Documentation

◆ GetRemoteDocument()

template<typename SchemaDocumentType = SchemaDocument>
virtual const SchemaDocumentType * RemoteSchemaDocumentProvider< SchemaDocumentType >::GetRemoteDocument ( const char * uri,
SizeType length )
inlinevirtual

Definition at line 1747 of file schematest.cpp.

1747 {
1748 for (size_t i = 0; i < kCount; i++)
1749 if (typename SchemaDocumentType::URIType(uri, length) == sd_[i]->GetURI())
1750 return sd_[i];
1751 return 0;
1752 }

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