1 | /*
|
---|
2 | * TOPPERS Software
|
---|
3 | * Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
4 | *
|
---|
5 | * Copyright (C) 2005-2008 by TAKAGI Nobuhisa
|
---|
6 | *
|
---|
7 | * ãLì ÒÍCȺÌ(1)`(4)Ìðð½·êÉÀèC{\tgEF
|
---|
8 | * Ai{\tgEFAðüϵ½àÌðÜÞDȺ¯¶jðgpE¡»Eü
|
---|
9 | * ÏEÄzziȺCpÆÄÔj·é±Æð³Åø·éD
|
---|
10 | * (1) {\tgEFAð\[XR[hÌ`Åp·éêÉÍCãLÌì
|
---|
11 | * \¦C±Ìpð¨æÑºLÌ³ÛØKèªC»ÌÜÜÌ`Å\[
|
---|
12 | * XR[hÉÜÜêĢ鱯D
|
---|
13 | * (2) {\tgEFAðCCu`®ÈÇC¼Ì\tgEFAJÉg
|
---|
14 | * pÅ«é`ÅÄzz·éêÉÍCÄzzɺ¤hL
|
---|
15 | gip
|
---|
16 | * Ò}j
|
---|
17 | AÈÇjÉCãLÌì \¦C±Ìpð¨æÑºL
|
---|
18 | * Ì³ÛØKèðfÚ·é±ÆD
|
---|
19 | * (3) {\tgEFAðC@íÉgÝÞÈÇC¼Ì\tgEFAJÉg
|
---|
20 | * pūȢ`ÅÄzz·éêÉÍCÌ¢¸ê©Ìðð½·±
|
---|
21 | * ÆD
|
---|
22 | * (a) Äzzɺ¤hL
|
---|
23 | gipÒ}j
|
---|
24 | AÈÇjÉCãLÌ
|
---|
25 | * ì \¦C±Ìpð¨æÑºLÌ³ÛØKèðfÚ·é±ÆD
|
---|
26 | * (b) ÄzzÌ`ÔðCÊÉèßéû@ÉæÁÄCTOPPERSvWFNgÉ
|
---|
27 | * ñ·é±ÆD
|
---|
28 | * (4) {\tgEFAÌpÉæè¼ÚIܽÍÔÚIɶ¶é¢©Èé¹
|
---|
29 | * Q©çàCãLì Ò¨æÑTOPPERSvWFNgðÆÓ·é±ÆD
|
---|
30 | * ܽC{\tgEFAÌ[UܽÍGh[U©çÌ¢©Èé
|
---|
31 | * RÉîÿ©çàCãLì Ò¨æÑTOPPERSvWFNgð
|
---|
32 | * ÆÓ·é±ÆD
|
---|
33 | *
|
---|
34 | * {\tgEFAÍC³ÛØÅñ³êÄ¢éàÌÅ éDãLì Ò¨
|
---|
35 | * æÑTOPPERSvWFNgÍC{\tgEFAÉÖµÄCÁèÌgpÚI
|
---|
36 | * ÉηéK«àÜßÄC¢©ÈéÛØàsíÈ¢DܽC{\tgEF
|
---|
37 | * AÌpÉæè¼ÚIܽÍÔÚIɶ¶½¢©Èé¹QÉÖµÄàC»
|
---|
38 | * ÌÓCðíÈ¢D
|
---|
39 | *
|
---|
40 | */
|
---|
41 |
|
---|
42 | /*!
|
---|
43 | * \file toppers/text_line.hpp
|
---|
44 | * \brief eLXgf[^ÌsÉÖ·éé¾è`
|
---|
45 | *
|
---|
46 | * ±Ìt@CÅè`³êéNX
|
---|
47 | * \code
|
---|
48 | * struct text_line;
|
---|
49 | * struct basic_line_buf< CharT, Traits, Allocator >;
|
---|
50 | * \endcode
|
---|
51 | */
|
---|
52 | #ifndef TOPPERS_TEXTLINE_HPP_
|
---|
53 | #define TOPPERS_TEXTLINE_HPP_
|
---|
54 |
|
---|
55 | #include <iosfwd>
|
---|
56 | #include <string>
|
---|
57 | #include <algorithm>
|
---|
58 | #include "toppers/config.hpp"
|
---|
59 |
|
---|
60 | namespace toppers
|
---|
61 | {
|
---|
62 |
|
---|
63 | /*!
|
---|
64 | * \struct text_line text_line.hpp "toppers/text_line.hpp"
|
---|
65 | * \brief t@C¼ÆsÔÌÛNX
|
---|
66 | */
|
---|
67 | struct text_line
|
---|
68 | {
|
---|
69 | std::string file; //!< t@C¼
|
---|
70 | long line; //!< sÔi1`j
|
---|
71 |
|
---|
72 | /*!
|
---|
73 | * \brief ftHgRXgN^
|
---|
74 | */
|
---|
75 | text_line()
|
---|
76 | : line( 0 )
|
---|
77 | {
|
---|
78 | }
|
---|
79 | /*!
|
---|
80 | * \brief RXgN^
|
---|
81 | * \param filename t@C¼
|
---|
82 | * \param lineno sÔ
|
---|
83 | */
|
---|
84 | explicit text_line( std::string const& filename, long lineno = 0 )
|
---|
85 | : file( filename ), line( lineno )
|
---|
86 | {
|
---|
87 | }
|
---|
88 | /*!
|
---|
89 | * \brief RXgN^
|
---|
90 | * \param filename t@C¼
|
---|
91 | * \param lineno sÔ
|
---|
92 | */
|
---|
93 | explicit text_line( char const* filename, long lineno = 0 )
|
---|
94 | : file( filename ), line( lineno )
|
---|
95 | {
|
---|
96 | }
|
---|
97 | /*!
|
---|
98 | * \brief IuWFNgÌð·
|
---|
99 | * \param other ð·ÎÛÌIuWFNg
|
---|
100 | */
|
---|
101 | void swap( text_line& other ) throw()
|
---|
102 | {
|
---|
103 | std::swap( line, other.line );
|
---|
104 | file.swap( other.file );
|
---|
105 | }
|
---|
106 | };
|
---|
107 |
|
---|
108 | /*!
|
---|
109 | * \struct line_buf text_line.hpp "toppers/text_line.hpp"
|
---|
110 | * \brief 1 seLXgÌÇNX
|
---|
111 | */
|
---|
112 | template
|
---|
113 | <
|
---|
114 | typename CharT,
|
---|
115 | class Traits = std::char_traits< CharT >,
|
---|
116 | class Allocator = std::allocator< CharT >
|
---|
117 | >
|
---|
118 | struct basic_line_buf
|
---|
119 | {
|
---|
120 | typedef std::basic_string< CharT, Traits, Allocator > string_type;
|
---|
121 |
|
---|
122 | string_type buf; //!< sf[^ð\·¶ñ
|
---|
123 | text_line line; //!< sÔîñ
|
---|
124 |
|
---|
125 | /*!
|
---|
126 | * \brief ftHgRXgN^
|
---|
127 | */
|
---|
128 | basic_line_buf()
|
---|
129 | {
|
---|
130 | }
|
---|
131 | /*!
|
---|
132 | * \brief RXgN^
|
---|
133 | * \param line sÔîñ
|
---|
134 | */
|
---|
135 | basic_line_buf( text_line const& line )
|
---|
136 | : line( line )
|
---|
137 | {
|
---|
138 | }
|
---|
139 | /*!
|
---|
140 | * \brief RXgN^
|
---|
141 | * \param line sÔîñ
|
---|
142 | * \param data sf[^
|
---|
143 | */
|
---|
144 | basic_line_buf( text_line const& line, string_type const& data )
|
---|
145 | : buf( data ), line( line )
|
---|
146 | {
|
---|
147 | }
|
---|
148 | };
|
---|
149 |
|
---|
150 | //! char ÅÌ 1 seLXgÇNX
|
---|
151 | typedef basic_line_buf< char > line_buf;
|
---|
152 |
|
---|
153 | /*!
|
---|
154 | * \brief Ce[^ªÛ·ésÔîñÌæ¾
|
---|
155 | * \param iter Ce[^
|
---|
156 | * \return sÔîñÖÌQÆðÔ·
|
---|
157 | *
|
---|
158 | * iter Åwèµ½Ce[^ªsÔîñð۵ĢéÈçA»ÌsÔîñðԵܷB
|
---|
159 | * sÔîñð۵ĢȢêÍ_~[IuWFNgÖÌQÆðԵܷB
|
---|
160 | */
|
---|
161 | template < class Iterator >
|
---|
162 | inline text_line const& get_text_line( Iterator iter )
|
---|
163 | {
|
---|
164 | static text_line dummy;
|
---|
165 | return dummy;
|
---|
166 | }
|
---|
167 |
|
---|
168 | }
|
---|
169 |
|
---|
170 | #endif // ! TOPPERS_TEXTLINE_HPP_
|
---|