}
catch(exception& e) {
103d->SetUsageContext(
"datatool",
"work with ASN.1/XML data");
106d->AddKey(
"m",
"moduleFile",
110d->AddDefaultKey(
"M",
"externalModuleFile",
111 "external module file(s)",
115 "ignore unresolved symbols");
116d->AddOptionalKey(
"f",
"moduleFile",
117 "write ASN.1 module file",
119d->AddOptionalKey(
"fx",
"dtdFile",
120 "write DTD file (\"-fx m\" writes modular DTD file)",
122d->AddOptionalKey(
"fxs",
"XMLSchemaFile",
123 "write XML Schema file (\"-fxs m\" writes modular Schema file)",
125d->AddOptionalKey(
"fjs",
"JSONSchemaFile",
126 "write JSON Schema file",
128d->AddOptionalKey(
"fd",
"SpecificationDump",
129 "write specification dump file (datatool internal format)",
131d->AddOptionalKey(
"ms",
"moduleSuffix",
132 "suffix of modular DTD or Schema file name",
136d->AddOptionalKey(
"v",
"valueFile",
137 "read value in ASN.1 text format",
139d->AddOptionalKey(
"vx",
"valueFile",
140 "read value in XML format",
142d->AddOptionalKey(
"vj",
"valueFile",
143 "read value in JSON format",
145d->AddOptionalKey(
"d",
"valueFile",
146 "read value in ASN.1 binary format (-t is required)",
148d->AddOptionalKey(
"tvs",
"traversalSpecFile",
149 "read traversal specification file",
151d->AddOptionalKey(
"t",
"type",
152 "binary value type (see \"-d\" argument)",
154d->AddOptionalKey(
"dn",
"filename",
155 "DTD module name in XML header (no extension). " 156 "If empty, omit DOCTYPE line.",
159 "read value completely into memory");
160d->AddOptionalKey(
"p",
"valueFile",
161 "write value in ASN.1 text format",
163d->AddOptionalKey(
"px",
"valueFile",
164 "write value in XML format",
166d->AddOptionalKey(
"pj",
"valueFile",
167 "write value in JSON format",
169d->AddOptionalKey(
"xmlns",
"namespaceName",
170 "XML namespace name",
172d->AddOptionalKey(
"e",
"valueFile",
173 "write value in ASN.1 binary format",
176 "no scope prefixes in XML output");
178 "no scope prefixes in XML input");
181d->AddOptionalKey(
"oex",
"exportSpec",
182 "class export specifier for MSVC",
184d->AddOptionalKey(
"od",
"defFile",
185 "code definition file",
188 "silently ignore absent code definition file");
190 "issue a warning about absent code definition file");
192 "generate sample definition file");
193d->AddOptionalKey(
"of",
"listFile",
194 "write list of generated C++ files",
196d->AddOptionalKey(
"oc",
"basename",
197 "write combining C++ files",
200 "generate C++ files for all types");
201d->AddOptionalKey(
"ot",
"types",
202 "generate C++ files for listed types",
204d->AddOptionalKey(
"ox",
"types",
205 "exclude listed types from generation",
208 "turn off recursive type generation");
210d->AddOptionalKey(
"on",
"namespace",
211 "default namespace",
214d->AddOptionalKey(
"opm",
"directory",
215 "directory for searching source modules",
217d->AddOptionalKey(
"oph",
"directory",
218 "directory for generated *.hpp files",
220d->AddOptionalKey(
"opc",
"directory",
221 "directory for generated *.cpp files",
224d->AddOptionalKey(
"or",
"prefix",
225 "add prefix to generated file names",
228 "use quoted syntax form for generated include files");
230 "add source file dir to generated file names");
232 "add module name to generated file names");
234 "combine all -or* prefixes");
236 "create \".cvsignore\" files");
237d->AddOptionalKey(
"oR",
"rootDirectory",
238 "set \"-o*\" arguments for NCBI directory tree",
242 "turn on generation of DOXYGEN-style comments");
243d->AddOptionalKey(
"odx",
"URL",
244 "URL of documentation root folder (for DOXYGEN)",
246d->AddFlag(
"lax_syntax",
247 "allow non-standard ASN.1 syntax accepted by asntool");
248d->AddOptionalKey(
"pch",
"file",
249 "name of the precompiled header to include in all *.cpp files",
260 if(
const CArgValue& od = args[
"od"] )
263list<string> modulesPath;
268 if(!style.empty()) {
269vector<string> values;
271 for(
const string& v : values) {
292 const string& rootDir = opt;
295 stringsrcDir =
Path(rootDir,
"src");
297modulesPath.push_back(srcDir);
309modulesPath, args[
"m"].GetStringList(),
false);
313modulesPath, args[
"M"].GetStringList(),
true, srctype);
316 if( args[
"sxo"] ) {
329 if(
const CArgValue& fx = args[
"fx"] ) {
333 if( fx.AsString() ==
"m") {
346 if(
const CArgValue& ax = args[
"fxs"] ) {
350 if( ax.AsString() ==
"m") {
362 if(
const CArgValue& ax = args[
"fjs"] ) {
368 if( !args[
"i"] ) {
382 boolstdXmlIn =
false;
383 if( args[
"sxi"] ) {
386 boolstdXmlOut =
false;
387 if( args[
"sxo"] ) {
396 if(
const CArgValue& v = args[
"v"] ) {
400 else if(
const CArgValue& vx = args[
"vx"] ) {
404 else if(
const CArgValue& vj = args[
"vj"] ) {
408 else if(
const CArgValue& d = args[
"d"] ) {
410 ERR_POST_X(3,
"ASN.1 value type must be specified (-t)");
419unique_ptr<CObjectIStream>
432typeName =
t.AsString();
433 if(typeName !=
"?") {
434 in->ReadFileHeader();
438typeName =
in->ReadFileHeader();
440typeName =
"JsonValue";
444 booltype_guessed =
false;
445 if(typeName !=
"?") {
448 stringalt_name(typeName);
456 if(alt_name.find(
'_') == string::npos) {
468type_guessed =
true;
472 if(matching_types.
size() == 0) {
474}
else if(matching_types.
size() == 1) {
475typeInfo = *matching_types.
begin();
477 string msg(
"Multiple typeinfo matches:");
479 msg+=
" "+ (*ti)->GetName();
483 in->ReadFileHeader();
492 booluse_nsName =
false;
495 if(
const CArgValue& p = args[
"p"] ) {
499 else if(
const CArgValue& px = args[
"px"] ) {
502 if(
const CArgValue& px_ns = args[
"xmlns"] ) {
504nsName = px_ns.AsString();
507 else if(
const CArgValue& pj = args[
"pj"] ) {
511 else if(
const CArgValue& e = args[
"e"] ) {
516 if(typeName ==
"?") {
517cout <<
"Data type: "<< typeInfo->
GetName() << endl;
523 boolreadFull =
bool(args[
"F"]);
526unique_ptr<CObjectOStream>
537 if(!nsName.empty()) {
542 if(
const CArgValue& dn = args[
"dn"] ) {
543 const string& name = dn.AsString();
544 if( name.empty() ) {
563 if(!
in->EndOfData()) {
570 prev.insert(typeInfo);
572 for(
boolgo=
true; go && !
in->EndOfData(); ) {
574matching =
in->GuessDataType(
prev,2);
575 if(matching.
empty()) {
576matching =
in->GuessDataType(known_types,16);
578 if(matching.
size() == 1) {
579typeInfo = *matching.
begin();
581 prev.insert(typeInfo);
587copier.
Copy(typeInfo);
625 boolgeneration_requested =
false;
630generation_requested =
true;
636generation_requested =
true;
665root =
"https://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/lxr/source";
686}
else if(opt ==
"-") {
692 const string& fileName = opt;
724 if(generation_requested) {
726 ERR_POST_X(5,
"*** Datatool code generation failed");
747traversal_spec_file );
748 ERR_POST_X(2,
Info<<
"Total seconds to generate traversal code: "<< total_code_generation_stop_watch.
Restart() );
749}
catch( exception &ex ) {
750cerr <<
"Exception: "<< ex.what() << endl;
758 CFileSet& fileSet,
constlist<string>& modulesPath,
778 if(names_done.
find(name) != names_done.
end()) {
782 if( !name.empty() ) {
783names_done.
insert(name);
785moduleType = fName.
GetType();
792srctype = moduleType;
797moduleType = srctype;
800 else if(moduleType != srctype) {
802 "Unable to process modules of different types" 803 " simultaneously: "+name);
807 switch(moduleType) {
bool AllowIDsEndingWithMinus(void) const
AutoPtr< CFileModules > Modules(const string &fileName)
static void SetExportSpecifier(const string &str)
static void SetDoxygenComments(bool set)
static void SetDoxygenGroup(const string &str)
static void SetDocRootURL(const string &str)
void UseQuotedForm(bool use)
const string & GetCPPDir(void) const
void ResolveImportRefs(void)
void SetFileNamePrefix(const string &prefix)
void LoadConfig(CNcbiIstream &in)
CFileSet & GetMainModules(void)
bool HaveGenerateTypes(void) const
void SetDoxygenIngroup(const string &str)
void ExcludeRecursion(bool exclude=true)
virtual const CMemoryRegistry & GetConfig(void) const override
void SetRootDir(const string &dir)
void SetHPPDir(const string &dir)
void SetFileNamePrefixSource(EFileNamePrefixSource source)
void ExcludeTypes(const string &types)
void SetCPPDir(const string &dir)
void SetFileListFileName(const string &file)
bool GetOpt(const string &opt, string *value=0)
void SetDefaultNamespace(const string &ns)
void SetCombiningFileName(const string &file)
void UndoGenerateCode(void)
void ResetDefaultNamespace(void)
void CreateCvsignore(bool create)
CFileSet & GetImportModules(void)
void IncludeAllMainTypes(void)
void IncludeTypes(const string &types)
void SetDoxygenGroupDescription(const string &str)
static void SetModuleFileSuffix(const string &suffix)
static void EnableDTDEntities(bool enable=true)
static void SetSourceDataSpec(EDataSpec spec)
static EDataSpec GetSourceDataSpec(void)
static void SetEnforcedStdXml(bool set=true)
static void SetPchHeader(const string &name)
void PrintDTD(CNcbiOstream &out) const
void CollectAllTypeinfo(set< TTypeInfo > &types) const
void PrintSpecDump(CNcbiOstream &out) const
void PrintJSONSchema(CNcbiOstream &out) const
void AddFile(const AutoPtr< CFileModules > &moduleSet)
void PrintXMLSchema(CNcbiOstream &out) const
void PrintDTDModular(void) const
CDataType * ResolveInAnyModule(const string &fullName, bool allowInternal=false) const
void PrintXMLSchemaModular(void) const
void PrintSampleDEF(const string &rootdir) const
void PrintASN(CNcbiOstream &out) const
Root class for all serialization exceptions.
CTypeInfo class contains all information about C++ types (both basic and classes): members and layout...
AutoPtr< CFileModules > Modules(const string &fileName)
EType GetType(void) const
string GetFileName(void) const
iterator_bool insert(const value_type &val)
const_iterator begin() const
const_iterator find(const key_type &key) const
const_iterator end() const
Include a standard set of the NCBI C++ Toolkit most basic headers.
std::ofstream out("events_result.xml")
main entry point for tests
string Path(const string &dir, const string &file)
static const struct name_t names[]
static DLIST_TYPE *DLIST_NAME() prev(DLIST_LIST_TYPE *list, DLIST_TYPE *item)
virtual const CArgs & GetArgs(void) const
Get parsed command line arguments.
int AppMain(int argc, const char *const *argv, const char *const *envp=0, EAppDiagStream diag=eDS_Default, const char *conf=NcbiEmptyCStr, const string &name=NcbiEmptyString)
Main function (entry point) for the NCBI application.
virtual void SetupArgDescriptions(CArgDescriptions *arg_desc)
Setup the command line argument descriptions.
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
const string & GetProgramDisplayName(void) const
Get the application's "display" name.
const CVersionAPI & GetFullVersion(void) const
Get the program version information.
void SetVersion(const CVersionInfo &version)
Set the version number for the program.
virtual CNcbiIstream & AsInputFile(TFileFlags flags=0) const =0
Get the argument as an input file stream.
vector< string > TStringArray
Some values types can contain several value lists.
@ fAllowMultiple
Repeated key arguments are legal (use with AddKey)
@ eInputFile
Name of file (must exist and be readable)
@ eString
An arbitrary string.
@ eOutputFile
Name of file (must be writable)
EDiagSev SetDiagPostLevel(EDiagSev post_sev=eDiag_Error)
Set the threshold severity for posting the messages.
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
@ eDS_Default
Try standard log file (app.name + ".log") in /log/, use stderr on failure.
@ eDiag_Warning
Warning message.
TErrCode GetErrCode(void) const
Get error code.
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string.
#define NCBI_RETHROW_SAME(prev_exception, message)
Generic macro to re-throw the same exception.
void Warning(CExceptionArgs_Base &args)
static bool EnableBackgroundReporting(bool enable)
Enable background reporting.
virtual const char * what(void) const noexcept
Standard report (includes full backlog).
void Info(CExceptionArgs_Base &args)
ESerialDataFormat
Data file format.
@ eSerial_AsnText
ASN.1 text.
@ eSerial_AsnBinary
ASN.1 binary.
void SetDefaultStringEncoding(EEncoding enc)
Set default encoding of 'string' objects If XML data encoding is different, string will be converted ...
void SetReferenceSchema(bool use_schema=true)
Make generated XML document reference XML schema.
void SetReferenceDTD(bool use_dtd=true)
Make generated XML document reference DTD.
static CObjectOStream * Open(ESerialDataFormat format, CNcbiOstream &outStream, bool deleteOutStream)
Create serial object writer and attach it to an output stream.
void SetDefaultStringEncoding(EEncoding enc)
Set default encoding of 'string' objects If XML data encoding is different, string will be converted ...
static CObjectIStream * Open(ESerialDataFormat format, CNcbiIstream &inStream, bool deleteInStream)
Create serial object reader and attach it to an input stream.
void SetDTDFileName(const string &filename)
Set DTD or schema file name.
void SetEnforcedStdXml(bool set=true)
Set up scope prefixes handling.
void SetEnforcedStdXml(bool set=true)
Set up scope prefixes handling.
void SetDefaultSchemaNamespace(const string &schema_ns)
Set default value of namespace name of generated DTD documents.
void Copy(const CObjectTypeInfo &type)
Copy data.
@ eEOF
Unexpected end-of-file.
virtual const string & Get(const string §ion, const string &name, TFlags flags=0) const
Get the parameter value.
bool Empty(TFlags flags=fAllLayers) const
Verify if Registry is empty.
#define END_NCBI_SCOPE
End previously defined NCBI scope.
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
#define USING_NCBI_SCOPE
For using NCBI namespace code.
IO_PREFIX::istream CNcbiIstream
Portable alias for istream.
static int CompareNocase(const CTempString s1, SIZE_TYPE pos, SIZE_TYPE n, const char *s2)
Case-insensitive compare of a substring with another string.
static list< string > & Split(const CTempString str, const CTempString delim, list< string > &arr, TSplitFlags flags=0, vector< SIZE_TYPE > *token_pos=NULL)
Split a string using specified delimiters.
static string & ReplaceInPlace(string &src, const string &search, const string &replace, SIZE_TYPE start_pos=0, SIZE_TYPE max_replace=0, SIZE_TYPE *num_replace=0)
Replace occurrences of a substring within a string.
static string TruncateSpaces(const string &str, ETrunc where=eTrunc_Both)
Truncate whitespace in a string.
@ fSplit_Tokenize
All delimiters are merged and trimmed, to get non-empty tokens only.
@ fSplit_MergeDelimiters
Merge adjacent delimiters.
double Restart(void)
Return time elapsed since first Start() or last Restart() call (in seconds).
@ eStart
Start timer immediately after creating.
const string & GetName(void) const
Get name of this type.
string Print(const string &appname, TPrintFlags flags=fPrintAll) const
Print version data, plain text.
@ fVersionInfo
Print version info.
Definition of all error codes used in serial libraries (xser.lib, xcser.lib).
@ eFileName_UseAllPrefixes
@ eFileName_FromSourceFileName
@ eFileName_FromModuleName
const GenericPointer< typename T::ValueType > T2 value
Defines command line argument related classes.
std::istream & in(std::istream &in_, double &x_)
static SLJIT_INLINE sljit_ins ms(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
static SLJIT_INLINE sljit_ins msg(sljit_gpr r, sljit_s32 d, sljit_gpr x, sljit_gpr b)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4