NCBI C++ ToolKit
comments.hpp
Go to the documentation of this file.

Go to the SVN repository for this file.

1 #ifndef COMMENTS__HPP
2 #define COMMENTS__HPP
3 
4 /* $Id: comments.hpp 69987 2015-11-25 13:58:19Z gouriano $
5 * ===========================================================================
6 *
7 * PUBLIC DOMAIN NOTICE
8 * National Center for Biotechnology Information
9 *
10 * This software/database is a "United States Government Work" under the
11 * terms of the United States Copyright Act. It was written as part of
12 * the author's official duties as a United States Government employee and
13 * thus cannot be copyrighted. This software/database is freely available
14 * to the public for use. The National Library of Medicine and the U.S.
15 * Government have not placed any restriction on its use or reproduction.
16 *
17 * Although all reasonable efforts have been taken to ensure the accuracy
18 * and reliability of the software and data, the NLM and the U.S.
19 * Government do not and cannot warrant the performance or results that
20 * may be obtained by using this software or data. The NLM and the U.S.
21 * Government disclaim all warranties, express or implied, including
22 * warranties of performance, merchantability or fitness for any particular
23 * purpose.
24 *
25 * Please cite the author in any work or product based on this material.
26 *
27 * ===========================================================================
28 *
29 * Author: Eugene Vasilchenko
30 *
31 * File Description:
32 * !!! PUT YOUR DESCRIPTION HERE !!!
33 *
34 */
35 
36 #include <corelib/ncbistd.hpp>
37 #include <list>
38 
40 
41 #define _DATATOOL_USE_SCHEMA_STYLE_COMMENTS 1
42 
43 class CComments
44 {
45 public:
46  CComments(void);
47  ~CComments(void);
48  CComments& operator= (const CComments& other);
49 
50  void Add(const string& s);
51 
52  enum {
55  eNoEOL = 4,
58  };
59 
60  bool Empty(void) const;
61  bool OneLine(void) const;
62 
63  CNcbiOstream& Print(CNcbiOstream& out, const string& before,
64  const string& between, const string& after) const;
65  bool PrintSchemaComments(CNcbiOstream& out, int indent, int flags = 0) const;
66  CNcbiOstream& PrintDTD(CNcbiOstream& out, int flags = 0) const;
67  CNcbiOstream& PrintASN(CNcbiOstream& out, int indent, int flags = 0) const;
68 
69  // shortcuts
73 
74 private:
75  typedef list<string> TComments;
76 
78 };
79 
80 template<class Container>
81 inline
82 bool SizeIsOne(const Container& cont)
83 {
84  typename Container::const_iterator it = cont.begin(), end = cont.end();
85  return it != end && ++it == end;
86 }
87 
88 inline
89 bool CComments::Empty(void) const
90 {
91  return m_Comments.empty();
92 }
93 
94 inline
95 bool CComments::OneLine(void) const
96 {
97  return SizeIsOne(m_Comments);
98 }
99 
101 
102 #endif /* COMMENTS__HPP */
void Add(const string &s)
Definition: comments.cpp:55
TComments m_Comments
Definition: comments.hpp:77
CNcbiOstream & PrintASN(CNcbiOstream &out, int indent, int flags=0) const
Definition: comments.cpp:156
CComments(void)
Definition: comments.cpp:41
bool PrintSchemaComments(CNcbiOstream &out, int indent, int flags=0) const
Definition: comments.cpp:91
CNcbiOstream & PrintHPPClass(CNcbiOstream &out) const
Definition: comments.cpp:81
CNcbiOstream & Print(CNcbiOstream &out, const string &before, const string &between, const string &after) const
Definition: comments.cpp:60
CComments & operator=(const CComments &other)
Definition: comments.cpp:49
CNcbiOstream & PrintHPPMember(CNcbiOstream &out) const
Definition: comments.cpp:86
list< string > TComments
Definition: comments.hpp:75
bool Empty(void) const
Definition: comments.hpp:89
CNcbiOstream & PrintDTD(CNcbiOstream &out, int flags=0) const
Definition: comments.cpp:121
~CComments(void)
Definition: comments.cpp:45
bool OneLine(void) const
Definition: comments.hpp:95
@ eMultiline
Definition: comments.hpp:57
@ eDoNotWriteBlankLine
Definition: comments.hpp:54
@ eAlwaysMultiline
Definition: comments.hpp:53
CNcbiOstream & PrintHPPEnum(CNcbiOstream &out) const
Definition: comments.cpp:76
bool SizeIsOne(const Container &cont)
Definition: comments.hpp:82
Include a standard set of the NCBI C++ Toolkit most basic headers.
static uch flags
std::ofstream out("events_result.xml")
main entry point for tests
#define END_NCBI_SCOPE
End previously defined NCBI scope.
Definition: ncbistl.hpp:103
#define BEGIN_NCBI_SCOPE
Define ncbi namespace.
Definition: ncbistl.hpp:100
IO_PREFIX::ostream CNcbiOstream
Portable alias for ostream.
Definition: ncbistre.hpp:149
string indent(" ")
Modified on Mon Jul 15 05:36:07 2024 by modify_doxy.py rev. 669887