You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
738 B
30 lines
738 B
|
|
#ifndef PROTOIMPORTER_H_
|
|
#define PROTOIMPORTER_H_
|
|
|
|
#include "Singleton.h"
|
|
|
|
#include <string>
|
|
|
|
#include <google/protobuf/dynamic_message.h>
|
|
#include <google/protobuf/compiler/importer.h>
|
|
|
|
class ProtoImporter
|
|
{
|
|
public:
|
|
ProtoImporter();
|
|
public:
|
|
void MapPath(const std::string& virtual_path, const std::string& disk_path);
|
|
bool Import(const std::string& filename);
|
|
bool Import(const std::string&filename,const void * data, int size);
|
|
void CleanCacheFile();
|
|
void CleanMapPath();
|
|
google::protobuf::Message* createDynamicMessage(const std::string& typeName);
|
|
public:
|
|
google::protobuf::compiler::Importer importer;
|
|
google::protobuf::DynamicMessageFactory factory;
|
|
};
|
|
|
|
#define sProtoImporter Singleton<ProtoImporter>::instance()
|
|
|
|
#endif
|
|
|