NCBI C++ ToolKit
module.cpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 /* $Id: module.cpp 79718 2017-10-05 17:48:53Z gouriano $
2 * ===========================================================================
3 *
4 * PUBLIC DOMAIN NOTICE
5 * National Center for Biotechnology Information
6 *
7 * This software/database is a "United States Government Work" under the
8 * terms of the United States Copyright Act. It was written as part of
9 * the author's official duties as a United States Government employee and
10 * thus cannot be copyrighted. This software/database is freely available
11 * to the public for use. The National Library of Medicine and the U.S.
12 * Government have not placed any restriction on its use or reproduction.
13 *
14 * Although all reasonable efforts have been taken to ensure the accuracy
15 * and reliability of the software and data, the NLM and the U.S.
16 * Government do not and cannot warrant the performance or results that
17 * may be obtained by using this software or data. The NLM and the U.S.
18 * Government disclaim all warranties, express or implied, including
19 * warranties of performance, merchantability or fitness for any particular
20 * purpose.
21 *
22 * Please cite the author in any work or product based on this material.
23 *
24 * ===========================================================================
25 *
26 * Author: Eugene Vasilchenko
27 *
28 * File Description:
29 * Data descriptions module: equivalent of ASN.1 module
30 *
31 */
32 
33 #include <ncbi_pch.hpp>
34 #include <corelib/ncbistd.hpp>
35 #include <corelib/ncbidiag.hpp>
36 #include <corelib/ncbireg.hpp>
37 #include "module.hpp"
38 #include "exceptions.hpp"
39 #include "type.hpp"
40 #include "srcutil.hpp"
41 #include "fileutil.hpp"
42 #include <serial/error_codes.hpp>
43 #include <typeinfo>
44 
45 
46 #define NCBI_USE_ERRCODE_X Serial_Modules
47 
49 
51 
53  : m_SourceLine(0), m_Errors(false), m_Name(n),
54  m_TagDefault(CAsnBinaryDefs::eAutomatic)
55 {
56 }
57 
59 {
60 }
61 
63 {
64  m_SourceLine = line;
65 }
66 
67 void CDataTypeModule::AddDefinition(const string& name,
68  const AutoPtr<CDataType>& type)
69 {
70  CDataType*& oldType = m_LocalTypes[name];
71  if ( oldType ) {
72  type->Warning("redefinition, original: " +
73  oldType->LocationString(), 1);
74  m_Errors = true;
75  return;
76  }
77  CDataType* dataType = type.get();
78  oldType = dataType;
79  m_Definitions.push_back(make_pair(name, type));
80  dataType->SetParent(this, name);
81 }
82 
84 {
85  m_Exports.insert(m_Exports.end(), exports.begin(), exports.end());
86 }
87 
89 {
90  m_Imports.insert(m_Imports.end(), imports.begin(), imports.end());
91 }
92 
93 void CDataTypeModule::AddImports(const string& module, const list<string>& types)
94 {
95  AutoPtr<Import> import(new Import());
96  import->moduleName = module;
97  import->types.insert(import->types.end(), types.begin(), types.end());
98  m_Imports.push_back(import);
99 }
100 
101 void CDataTypeModule::SetSubnamespace(const string& sub_ns)
102 {
103  m_Subnamespace = sub_ns;
104 }
105 
107 {
108  string sn(GetVar(GetName(),"_subnamespace",false));
109  if (!sn.empty()) {
110  return sn;
111  }
112  return m_Subnamespace;
113 }
114 
116 {
117  if (m_Namespace.get()) {
118  return *m_Namespace;
119  }
121  string sub_ns(GetSubnamespace());
122  if (sub_ns.empty()) {
123  return def;
124  }
125  m_Namespace.reset( new CNamespace(def.ToString() + sub_ns));
126  return *m_Namespace;
127 }
128 
130 {
131  map< string, set< string > >::const_iterator s = m_DefVars.begin();
132  for (s = m_DefVars.begin(); s != m_DefVars.end(); ++s) {
133  out << "[" << s->first << "]" << endl;
134  ITERATE( set<string>, v, s->second) {
135  if (NStr::EndsWith(*v, "._class")) {
136  out << *v << " = " << endl;
137  }
138  }
139  out << endl;
140  }
141 }
142 
144 {
146 
147  out << ToAsnName(GetName()) << " DEFINITIONS ";
148 
150  out << "IMPLICIT";
151  } else if (m_TagDefault == CAsnBinaryDefs::eExplicit) {
152  out << "EXPLICIT";
153  } else {
154  out << "AUTOMATIC";
155  }
156  out << " TAGS ::=\nBEGIN\n\n";
157 
158  if ( !m_Exports.empty() ) {
159  out << "EXPORTS ";
160  ITERATE ( TExports, i, m_Exports ) {
161  if ( i != m_Exports.begin() )
162  out << ", ";
163  out << *i;
164  }
165  out <<
166  ";\n"
167  "\n";
168  }
169 
170  if ( !m_Imports.empty() ) {
171  out << "IMPORTS ";
172  ITERATE ( TImports, m, m_Imports ) {
173  if ( m != m_Imports.begin() )
174  out <<
175  "\n"
176  " ";
177 
178  const Import& imp = **m;
179  ITERATE ( list<string>, i, imp.types ) {
180  if ( i != imp.types.begin() )
181  out << ", ";
182  out << *i;
183  }
184  out << " FROM " << imp.moduleName;
185  }
186  out <<
187  ";\n"
188  "\n";
189  }
190 
192  i->second->PrintASNTypeComments(out, 0, CComments::eDoNotWriteBlankLine);
193  out << ToAsnName(i->first) << " ::= ";
194  i->second->PrintASN(out, 0);
195  out <<
196  "\n"
197  "\n";
198  }
199 
201 
202  out <<
203  "END\n"
204  "\n";
205 }
206 
208 {
212  PrintASNNewLine(out, 1);
213  out << "T," << i->second->GetSourceLine() << ','
214  << GetName() << ':' << i->second->GetMemberName();
215  }
216  PrintASNNewLine(out, 0);
217 
219  i->second->PrintSpecDump(out, 0);
220  }
221 }
222 
224 {
225  out << "{";
226  int indent = 1;
227  PrintASNNewLine(out, indent) << "\"$schema\": \"http://json-schema.org/draft-07/schema#\",";
228  list<string> req;
229  bool first = true;
231  if (i->second->GetGlobalType() != CDataType::eElement || CDataType::GetSourceDataSpec() != EDataSpec::eJSON) {
232  if (first) {
233  first = false;
234  PrintASNNewLine(out, indent++) << "\"definitions\": {";
235  } else {
236  cout << ',';
237  }
238  PrintASNNewLine(out, indent++) << "\"" << i->first << "\": {";
239  i->second->PrintJSONSchema(out,indent, req);
240  PrintASNNewLine(out, --indent) << "}";
241  }
242  }
243  if (!first) {
244  PrintASNNewLine(out, --indent) << "}";
245  }
246 
249  if (i->second->GetGlobalType() == CDataType::eElement) {
250  if (!first) {
251  cout << ',';
252  }
253  i->second->PrintJSONSchema(out,indent, req);
254  }
255  }
256  } else if (!m_Definitions.empty()) {
257 // as an example
258  cout << ',';
259  PrintASNNewLine(out, indent) << "\"type\": \"object\",";
260  PrintASNNewLine(out, indent++) << "\"properties\": {";
261  PrintASNNewLine(out, indent++) << "\"" << m_Definitions.front().first << "\": {";
262  PrintASNNewLine(out, indent) << "\"$ref\": \"#/definitions/" << m_Definitions.front().first << "\"";
263  PrintASNNewLine(out, --indent) << "}";
264  PrintASNNewLine(out, --indent) << "},";
265  PrintASNNewLine(out, indent) << "\"additionalProperties\": false";
266  }
267  PrintASNNewLine(out, --indent) << "}\n";
268 }
269 
270 // XML schema generator submitted by
271 // Marc Dumontier, Blueprint initiative, dumontier@mshri.on.ca
273 {
274  out <<
275  "<!-- ============================================ -->\n"
276  "<!-- This section is mapped from module \"" << GetName() << "\"\n"
277  "================================================= -->\n";
278 
280 
281  if ( !m_Exports.empty() ) {
282  out <<
283  "<!-- Elements used by other modules:\n";
284 
285  ITERATE ( TExports, i, m_Exports ) {
286  if ( i != m_Exports.begin() )
287  out << ",\n";
288  out << " " << *i;
289  }
290 
291  out << " -->\n\n";
292  }
293  if ( !m_Imports.empty() ) {
294  out <<
295  "<!-- Elements referenced from other modules:\n";
296  ITERATE ( TImports, i, m_Imports ) {
297  if ( i != m_Imports.begin() )
298  out << ",\n";
299  const Import* imp = i->get();
300  ITERATE ( list<string>, t, imp->types ) {
301  if ( t != imp->types.begin() )
302  out << ",\n";
303  out <<
304  " " << *t;
305  }
306  out << " FROM "<< imp->moduleName;
307  }
308  out << " -->\n\n";
309  }
310 
311  if ( !m_Exports.empty() || !m_Imports.empty() ) {
312  out <<
313  "<!-- ============================================ -->\n\n";
314  }
315 
316  m_ExtraDefs.clear();
318  out << "\n";
319 #if !_DATATOOL_USE_SCHEMA_STYLE_COMMENTS
320  i->second->PrintDTDTypeComments(out, 0);
321 #endif
322  i->second->PrintXMLSchema(out,0);
323  }
324  out << m_ExtraDefs;
325 
327  out << "\n\n";
328 }
329 
330 void CDataTypeModule::AddExtraSchemaOutput(const string& extra) const
331 {
332  m_ExtraDefs += "\n";
333  m_ExtraDefs += extra;
334 }
335 
337 {
338  out <<
339  "<!-- ============================================ -->\n"
340  "<!-- This section is mapped from module \"" << GetName() << "\"\n"
341  "================================================= -->\n";
342 
344 
345  if ( !m_Exports.empty() ) {
346  out <<
347  "\n\n<!-- Elements used by other modules:\n";
348 
349  ITERATE ( TExports, i, m_Exports ) {
350  if ( i != m_Exports.begin() )
351  out << ",\n";
352  out << " " << *i;
353  }
354 
355  out << " -->";
356  }
357  if ( !m_Imports.empty() ) {
358  out <<
359  "\n\n<!-- Elements referenced from other modules:\n";
360  ITERATE ( TImports, i, m_Imports ) {
361  if ( i != m_Imports.begin() )
362  out << ",\n";
363  const Import* imp = i->get();
364  ITERATE ( list<string>, t, imp->types ) {
365  if ( t != imp->types.begin() )
366  out << ",\n";
367  out <<
368  " " << *t;
369  }
370  out << " FROM "<< imp->moduleName;
371  }
372  out << " -->";
373  }
374 
375  if ( !m_Exports.empty() || !m_Imports.empty() ) {
376  out <<
377  "\n<!-- ============================================ -->";
378  }
379 
381 // out <<
382 // "<!-- Definition of "<<i->first<<" -->\n\n";
383  i->second->PrintDTD(out);
384  }
385 
387 
388  out << "\n\n";
389 }
390 
391 static
392 string DTDFileNameBase(const string& name)
393 {
394  string res;
395  ITERATE ( string, i, name ) {
396  char c = *i;
397  if ( c == '-' )
398  res += '_';
399  else
400  res += c;
401  }
402  return res;
403 }
404 
405 static
406 string DTDPublicModuleName(const string& name)
407 {
408  string res;
409  ITERATE ( string, i, name ) {
410  char c = *i;
411  if ( !isalnum((unsigned char) c) )
412  res += ' ';
413  else
414  res += c;
415  }
416  return res;
417 }
418 
420 {
421  return DTDPublicModuleName(GetName());
422 }
423 
425 {
426  return DTDFileNameBase(GetName());
427 }
428 
429 static
431  const string& name, const string& suffix)
432 {
433  string fileName = DTDFileNameBase(name);
434  string pubName = DTDPublicModuleName(name);
435  out
436  << "\n<!ENTITY % "
437  << fileName << "_module PUBLIC \"-//NCBI//" << pubName << " Module//EN\" \""
438  << fileName << suffix << ".mod.dtd\">\n%"
439  << fileName << "_module;\n";
440 }
441 
443 {
444  out <<
445  "<!-- "<<DTDFileNameBase(GetName())<<".dtd\n"
446  " This file is built from a series of basic modules.\n"
447  " The actual ELEMENT and ENTITY declarations are in the modules.\n"
448  " This file is used to put them together.\n"
449  "-->\n";
451 
452  list<string> l;
453 // l.assign(m_ImportRef.begin(), m_ImportRef.end());
455  l.push_back(*s);
456  }
457  l.sort();
458  ITERATE (list<string>, i, l) {
460  }
461 }
462 
464 {
465  out <<
466  "<!-- "<<DTDFileNameBase(GetName())<<".xsd\n"
467  " This file is built from a series of basic modules.\n"
468  " The actual declarations are in the modules.\n"
469  " This file is used to put them together.\n"
470  "-->\n";
471 
472  list<string> l;
473 // l.assign(m_ImportRef.begin(), m_ImportRef.end());
475  l.push_back(*s);
476  }
477  l.sort();
478  ITERATE (list<string>, i, l) {
479  out << "<xs:include schemaLocation=\"" << DTDFileNameBase(*i)
480  << GetModuleFileSuffix() << ".mod.xsd\"/>\n";
481  }
482 }
483 
485 {
486  bool ok = true;
488  if ( !d->second->Check() )
489  ok = false;
490  }
491  return ok;
492 }
493 
495 {
496  bool ok = true;
497  ITERATE ( TExports, e, m_Exports ) {
498  const string& name = *e;
500  if ( it == m_LocalTypes.end() ) {
501  ERR_POST_X(1, Warning << "undefined export type: " << name);
502  ok = false;
503  }
504  else {
505  m_ExportedTypes[name] = it->second;
506  }
507  }
508  ITERATE ( TImports, i, m_Imports ) {
509  const Import& imp = **i;
510  const string& module = imp.moduleName;
511  ITERATE ( list<string>, t, imp.types ) {
512  const string& name = *t;
513  if ( m_LocalTypes.find(name) != m_LocalTypes.end() ) {
514  ERR_POST_X(2, Warning <<
515  "import conflicts with local definition: " << name);
516  ok = false;
517  continue;
518  }
519  pair<TImportsByName::iterator, bool> ins =
521  if ( !ins.second ) {
522  ERR_POST_X(3, Warning << "duplicated import: " << name);
523  ok = false;
524  continue;
525  }
526  }
527  }
528  return ok;
529 }
530 
532  bool allowInternal) const
533 {
534  const TTypesByName& types = allowInternal? m_LocalTypes: m_ExportedTypes;
535  TTypesByName::const_iterator t = types.find(typeName);
536  if ( t != types.end() )
537  return t->second;
538 
539  if ( !allowInternal &&
540  m_LocalTypes.find(typeName) != m_LocalTypes.end() ) {
541  NCBI_THROW(CNotFoundException,eType, "not exported type: "+typeName);
542  }
543 
544  NCBI_THROW(CNotFoundException,eType, "undefined type: "+typeName);
545 }
546 
547 CDataType* CDataTypeModule::Resolve(const string& typeName) const
548 {
550  if ( t != m_LocalTypes.end() )
551  return t->second;
553  if ( i != m_ImportedTypes.end() )
554  return GetModuleContainer().InternalResolve(i->second, typeName);
555  NCBI_THROW(CNotFoundException,eType, "undefined type: "+typeName);
556 }
557 
559 {
560  _TRACE("module " << m_Name << ": " << GetModuleContainer().GetFileNamePrefixSource());
562  if ( m_PrefixFromName.empty() )
564  _TRACE("module " << m_Name << ": \"" << m_PrefixFromName << "\"");
565  if ( UseAllFileNamePrefixes() ) {
568  }
569  else {
570  return m_PrefixFromName;
571  }
572  }
574 }
575 
577  const string& typeName, const string& varName, bool collect) const
578 {
579  _ASSERT(!typeName.empty());
580  _ASSERT(!varName.empty());
581  {
582  const string s = x_GetVar(GetName() + '.' + typeName, varName);
583  if ( !s.empty() )
584  return s;
585  }
586  {
587  const string s = x_GetVar(typeName, varName, collect);
588  if ( !s.empty() )
589  return s;
590  }
591  {
592  const string s = x_GetVar(GetName(), varName);
593  if ( !s.empty() )
594  return s;
595  }
596  // default section
597  return x_GetVar("-", varName);
598 }
599 
601  const string& section, const string& value, bool collect) const
602 {
603  if (collect) {
604  m_DefVars[section].insert(value);
605  }
607  if (i == m_DefSections.end()) {
608  m_DefSections[section] = GetConfig().HasEntry(section);
609  i = m_DefSections.find(section);
610  if (i == m_DefSections.end()) {
611  return kEmptyStr;
612  }
613  if (i->second) {
614  list<string> entries;
615  GetConfig().EnumerateEntries(section,&entries);
616  m_DefSectionEntries[section] = entries;
617  }
618  }
619  if (!i->second) {
620  return kEmptyStr;
621  }
622  map< string, list< string > >::const_iterator e =
623  m_DefSectionEntries.find(section);
624  bool found = e != m_DefSectionEntries.end() &&
625  find(e->second.begin(), e->second.end(), value) != e->second.end();
626  return found ? GetConfig().Get(section, value) : kEmptyStr;
627 }
628 
629 bool CDataTypeModule::AddImportRef(const string& imp)
630 {
631  if (m_ImportRef.find(imp) == m_ImportRef.end()) {
632  m_ImportRef.insert(imp);
633  return true;
634  }
635  return false;
636 }
637 
638 string CDataTypeModule::ToAsnName(const string& name)
639 {
640  string asn;
641  asn.reserve(name.size());
642  bool first = true, hyphen = false;
643  for (string::const_iterator i = name.begin(); i != name.end();) {
644  unsigned char u = (unsigned char)(*i);
645  if (first) {
646  if (isalpha(u)) {
647  asn += (char)toupper(u);
648  } else {
649  asn += 'A';
650  if (isdigit(u)) {
651  asn += u;
652  } else {
653  hyphen = true;
654  asn += '-';
655  }
656  }
657  first = false;
658  } else if (isalpha(u) || isdigit(u)) {
659  hyphen = false;
660  asn += u;
661  } else if (!hyphen) {
662  hyphen = true;
663  asn += '-';
664  }
665  ++i;
666  }
667  if (hyphen) {
668  asn.resize( asn.size()-1 );
669  }
670  return asn;
671 }
672 
673 string CDataTypeModule::ToAsnId(const string& name)
674 {
675  string asn(name);
676  asn[0] = (char)tolower((unsigned char)asn[0]);
677  return asn;
678 }
679 
681 {
683  types.insert(i->second->GetTypeInfo().Get());
684  }
685 }
686 
687 
virtual ~CDataTypeModule()
Definition: module.cpp:58
const string x_GetVar(const string &section, const string &value, bool collect=false) const
Definition: module.cpp:600
iterator_bool insert(const value_type &val)
Definition: map.hpp:165
virtual const CNamespace & GetNamespace(void) const override
Definition: module.cpp:115
const string GetVar(const string &section, const string &value, bool collect) const
Definition: module.cpp:576
static const char * suffix[]
Definition: pcregrep.c:254
Definition: dbpivot.c:60
const CModuleContainer & GetModuleContainer(void) const
Definition: mcontainer.cpp:54
CAsnBinaryDefs::ETagType m_TagDefault
Definition: module.hpp:182
virtual void PrintXMLSchema(CNcbiOstream &out) const
Definition: module.cpp:272
int tolower(Uchar c)
Definition: ncbictype.hpp:72
bool UseAllFileNamePrefixes(void) const
Definition: mcontainer.hpp:72
std::ofstream out("events_result.xml")
main entry point for tests
int isalnum(Uchar c)
Definition: ncbictype.hpp:62
void CollectAllTypeinfo(set< TTypeInfo > &types) const
Definition: module.cpp:680
CDataType * ExternalResolve(const string &name, bool allowInternal=false) const
Definition: module.cpp:531
string GetDTDPublicName(void) const
Definition: module.cpp:419
void SetSourceLine(int line)
Definition: module.cpp:62
void Warning(CExceptionArgs_Base &args)
Definition: ncbiexpt.hpp:1035
int toupper(Uchar c)
Definition: ncbictype.hpp:73
iterator_bool insert(const value_type &val)
Definition: set.hpp:149
set< string > m_ImportRef
Definition: module.hpp:176
static EDataSpec GetSourceDataSpec(void)
Definition: type.hpp:378
int isalpha(Uchar c)
Definition: ncbictype.hpp:61
static string DTDFileNameBase(const string &name)
Definition: module.cpp:392
virtual void PrintJSONSchema(CNcbiOstream &out) const
Definition: module.cpp:223
TTypesByName m_LocalTypes
Definition: module.hpp:173
const_iterator find(const key_type &key) const
Definition: set.hpp:137
static string ToAsnId(const string &name)
Definition: module.cpp:673
static const unsigned char res[3][32]
Definition: ccm.c:389
const_iterator end() const
Definition: set.hpp:136
void AddImports(const TImports &imports)
Definition: module.cpp:88
#define kEmptyStr
Definition: ncbistr.hpp:120
CComments m_Comments
Definition: module.hpp:160
void AddExtraSchemaOutput(const string &extra) const
Definition: module.cpp:330
#define ITERATE(Type, Var, Cont)
ITERATE macro to sequence through container elements.
Definition: ncbimisc.hpp:790
virtual void PrintSpecDump(CNcbiOstream &out) const
Definition: module.cpp:207
int i
#define ERR_POST_X(err_subcode, message)
Error posting with default error code and given error subcode.
Definition: ncbidiag.hpp:544
string LocationString(void) const
Definition: type.cpp:441
string ToString(void) const
Definition: namespace.hpp:80
list< pair< string, AutoPtr< CDataType > > > TDefinitions
Definition: module.hpp:70
string Identifier(const string &typeName, bool capitalize)
Definition: srcutil.cpp:40
CComments m_LastComments
Definition: module.hpp:161
void AddExports(const TExports &exports)
Definition: module.cpp:83
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:101
const_iterator end() const
Definition: map.hpp:152
TTypesByName m_ExportedTypes
Definition: module.hpp:174
void AddDefinition(const string &name, const AutoPtr< CDataType > &type)
Definition: module.cpp:67
const_iterator find(const key_type &key) const
Definition: map.hpp:153
CNcbiOstream & PrintASN(CNcbiOstream &out, int indent, int flags=0) const
Definition: comments.cpp:156
void Warning(const string &mess, int err_subcode=0) const
Definition: type.cpp:115
CDataType * Resolve(const string &name) const
Definition: module.cpp:547
static const struct type types[]
Definition: type.c:25
void PrintSampleDEF(CNcbiOstream &out) const
Definition: module.cpp:129
void SetParent(const CDataType *parent, const string &memberName, string xmlName=kEmptyStr)
Definition: type.cpp:294
Definition: type.c:8
map< string, set< string > > m_DefVars
Definition: module.hpp:178
CNcbiOstream & PrintDTD(CNcbiOstream &out, int flags=0) const
Definition: comments.cpp:121
static wxAcceleratorEntry entries[3]
virtual const CMemoryRegistry & GetConfig(void) const
Definition: mcontainer.cpp:60
void SetSubnamespace(const string &sub_ns)
Definition: module.cpp:101
bool Check()
Definition: module.cpp:484
map< string, list< string > > m_DefSectionEntries
Definition: module.hpp:180
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:142
virtual bool HasEntry(const string &section, const string &name=kEmptyStr, TFlags flags=0) const
Definition: ncbireg.cpp:290
int isdigit(Uchar c)
Definition: ncbictype.hpp:64
virtual const string & Get(const string &section, const string &name, TFlags flags=0) const
Get the parameter value.
Definition: ncbireg.cpp:262
string GetSubnamespace(void) const
Definition: module.cpp:106
Definition: map.hpp:337
if(yy_accept[yy_current_state])
char value[7]
Definition: config.c:428
virtual const CNamespace & GetNamespace(void) const
Definition: mcontainer.cpp:90
void PrintDTDModular(CNcbiOstream &out) const
Definition: module.cpp:442
bool MakeFileNamePrefixFromModuleName(void) const
Definition: mcontainer.hpp:67
Process information in the NCBI Registry, including working with configuration files.
AutoPtr< CNamespace > m_Namespace
Definition: module.hpp:168
TImportsByName m_ImportedTypes
Definition: module.hpp:175
string m_ExtraDefs
Definition: module.hpp:181
static string DTDPublicModuleName(const string &name)
Definition: module.cpp:406
virtual void EnumerateEntries(const string &section, list< string > *entries, TFlags flags=fAllLayers) const
Enumerate parameter names for a specified section.
Definition: ncbireg.cpp:514
void PrintXMLSchemaModular(CNcbiOstream &out) const
Definition: module.cpp:463
bool AddImportRef(const string &imp)
Definition: module.cpp:629
Defines NCBI C++ diagnostic APIs, classes, and macros.
virtual EFileNamePrefixSource GetFileNamePrefixSource(void) const
Definition: mcontainer.cpp:79
string m_Subnamespace
Definition: module.hpp:167
virtual void PrintDTD(CNcbiOstream &out) const
Definition: module.cpp:336
string m_Name
Definition: module.hpp:159
list< string > TExports
Definition: module.hpp:69
TDefinitions m_Definitions
Definition: module.hpp:166
yy_size_t n
#define _ASSERT
element_type * get(void) const
Get pointer.
Definition: ncbimisc.hpp:461
TExports m_Exports
Definition: module.hpp:164
static void PrintModularDTDModuleReference(CNcbiOstream &out, const string &name, const string &suffix)
Definition: module.cpp:430
list< AutoPtr< Import > > TImports
Definition: module.hpp:68
static bool EndsWith(const CTempString str, const CTempString end, ECase use_case=eCase)
Check if a string ends with a specified suffix value.
Definition: ncbistr.hpp:5428
#define NCBI_THROW(exception_class, err_code, message)
Generic macro to throw an exception, given the exception class, error code and message string...
Definition: ncbiexpt.hpp:547
static string ToAsnName(const string &name)
Definition: module.cpp:638
const string & GetName(void) const
Definition: module.hpp:103
TImports m_Imports
Definition: module.hpp:165
list< string > types
Definition: module.hpp:66
void reset(element_type *p=0, EOwnership ownership=eTakeOwnership)
Reset will delete the old pointer (if owned), set content to the new value, and assume the ownership ...
Definition: ncbimisc.hpp:472
string m_PrefixFromName
Definition: module.hpp:162
virtual CDataType * InternalResolve(const string &moduleName, const string &typeName) const
Definition: mcontainer.cpp:84
virtual string GetFileNamePrefix(void) const override
Definition: module.cpp:558
const_iterator begin() const
Definition: map.hpp:151
virtual string GetFileNamePrefix(void) const
Definition: mcontainer.cpp:74
CDataTypeModule(const string &name)
Definition: module.cpp:52
string indent(" ")
string GetDTDFileNameBase(void) const
Definition: module.cpp:424
map< string, bool > m_DefSections
Definition: module.hpp:179
virtual void PrintASN(CNcbiOstream &out) const
Definition: module.cpp:143
#define _TRACE(message)
Definition: ncbidbg.hpp:120
static string s_ModuleFileSuffix
Definition: module.hpp:177
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:98
CNcbiOstream & PrintASNNewLine(CNcbiOstream &out, int indent)
Definition: srcutil.cpp:130
string Path(const string &dir, const string &file)
Definition: fileutil.cpp:243
bool CheckNames()
Definition: module.cpp:494
static string GetModuleFileSuffix(void)
Definition: module.hpp:137
Modified on Mon Nov 20 15:53:03 2017 by modify_doxy.py rev. 546573