Rheolef  7.1
an efficient C++ finite element environment
catchmark.h
Go to the documentation of this file.
1 # ifndef _RHEO_CATCHMARK_H
2 # define _RHEO_CATCHMARK_H
3 //
4 // This file is part of Rheolef.
5 //
6 // Copyright (C) 2000-2009 Pierre Saramito <Pierre.Saramito@imag.fr>
7 //
8 // Rheolef is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
12 //
13 // Rheolef is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
17 //
18 // You should have received a copy of the GNU General Public License
19 // along with Rheolef; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 //
22 // =========================================================================
23 
24 namespace rheolef {
58 } // namespace rheolef
59 
60 #include "rheolef/iorheo.h"
61 #include "rheolef/rheostream.h"
62 
63 namespace rheolef {
64 
65 // [verbatim_catchmark]
67 class catchmark {
68  public:
69  catchmark(const std::string& x);
70  const std::string& mark() const { return _mark; }
71  friend std::istream& operator >> (std::istream& is, const catchmark& m);
72  friend std::ostream& operator << (std::ostream& os, const catchmark& m);
73 // [verbatim_catchmark]
74  protected:
75  std::string _mark;
76 // [verbatim_catchmark_cont]
77 };
78 // [verbatim_catchmark_cont]
79 
80 // ================== [ inlined ] ==================================================
81 inline
82 catchmark::catchmark(const std::string& x)
83 : _mark(x)
84 {
85 }
86 inline
87 std::istream&
88 operator >> (std::istream& is, const catchmark& m)
89 {
90  is >> setmark(m._mark);
91  std::string label = "#"+m._mark;
92  if (!scatch(is,label)) {
93  warning_macro ("catchmark: label `"<< label <<"' not found on input");
94  }
95  return is;
96 }
97 inline
98 std::ostream&
99 operator << (std::ostream& os, const catchmark& m)
100 {
101  os << setmark(m._mark);
102  os << "#" << m._mark << std::endl;
103  return os;
104 }
105 }// namespace rheolef
106 # endif // _RHEO_CATCHMARK_H
see the catchmark page for the full documentation
Definition: catchmark.h:67
std::string _mark
Definition: catchmark.h:75
friend std::istream & operator>>(std::istream &is, const catchmark &m)
Definition: catchmark.h:88
friend std::ostream & operator<<(std::ostream &os, const catchmark &m)
Definition: catchmark.h:99
catchmark(const std::string &x)
Definition: catchmark.h:82
const std::string & mark() const
Definition: catchmark.h:70
This file is part of Rheolef.
std::istream & operator>>(std::istream &is, const catchmark &m)
Definition: catchmark.h:88
bool scatch(std::istream &in, const std::string &ch, bool full_match=true)
scatch: see the rheostream page for the full documentation
Definition: scatch.icc:52
std::ostream & operator<<(std::ostream &os, const catchmark &m)
Definition: catchmark.h:99