| 文件位置 | ![]() |
![]() |
![]() |
文件位置模板用于表示底层输入流中的具体标记位置。该标记位置包含对应的文件名、行号和列号,标记在此被识别。
namespace boost { namespace wave { namespace util { template <typename String = std::string> class file_position { public: file_position(); explicit file_position(String const &file, unsigned int line_ = 1, unsigned int column_ = 1); // accessors String const &get_file() const; unsigned int get_line() const; unsigned int get_column() const; void set_file(String const &file); void set_line(int line); void set_column(int column); }; } // namespace util } // namespace wave } // namespace boost
该file_position默认标记类型使用的模板需要用一个模板参数进行实例化,该参数指定用于存储文件位置的文件名成员的字符串类型。如果未提供此参数,则默认为一个std::string。请注意,作为模板参数提供的类型必须与一个std::string。请注意,作为模板参数提供的类型必须与一个std::string.
您可以根据需要使用自己的位置类型,但在任何情况下,这些类型都应实现与此处描述的file_position模板相同的接口。
file_position();
explicit file_position(String const &file,
unsigned int line_ = 1, unsigned int column_ = 1);
构造函数根据提供的参数初始化一个新实例的file_position。参数默认为空文件名,行号和列号设置为一。
get_file, get_line, get_column
String const &get_file() const; unsigned int get_line() const; unsigned int get_column() const;
该get_...函数用于访问文件位置成员的当前值:文件名(get_file),行号(get_line)和列号(get_column).
set_file, set_line, set_column
void set_file(String const &file); void set_line(unsigned int line); void set_column(unsigned int column);
该set_...函数用于为文件位置成员设置新值:文件名(set_file),行号(set_line)和列号(set_column).
![]() |
![]() |
版权所有 © 2003-2011 Hartmut Kaiser
根据 Boost Software License, Version 1.0 分发。(参见附带的 LICENSE_1_0.txt 文件或访问 https://boost.ac.cn/LICENSE_1_0.txt 副本)
最后更新日期2010年9月18日星期六 15:14