00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011 #if !defined(_XRB_DATAFILELOCATION_HPP_)
00012 #define _XRB_DATAFILELOCATION_HPP_
00013
00014 #include "xrb.hpp"
00015
00016 #include <iostream>
00017 #include <string>
00018
00019 namespace Xrb
00020 {
00021
00022 class DataFileLocation
00023 {
00024 public:
00025
00026 static DataFileLocation const ms_invalid;
00027
00028 DataFileLocation (std::string const &path, Uint32 line)
00029 :
00030 m_path(path),
00031 m_line(line)
00032 {
00033 assert(IsValid());
00034 }
00035
00036 inline bool IsValid () const
00037 {
00038 return !m_path.empty() && m_line > 0;
00039 }
00040 inline std::string const &Path () const
00041 {
00042 assert(IsValid() && "can't use DataFileLocation::ms_invalid in this manner");
00043 return m_path;
00044 }
00045 inline Uint32 Line () const
00046 {
00047 assert(IsValid() && "can't use DataFileLocation::ms_invalid in this manner");
00048 return m_line;
00049 }
00050 std::string Text () const;
00051
00052 private:
00053
00054
00055 DataFileLocation ()
00056 :
00057 m_path(),
00058 m_line(0)
00059 { }
00060
00061 std::string m_path;
00062 Uint32 m_line;
00063 };
00064
00065 std::ostream &operator << (std::ostream &stream, DataFileLocation const &file_location);
00066
00067 }
00068
00069 #endif // !defined(_XRB_DATAFILELOCATION_HPP_)