00001 #ifndef FG_SXSENT_H
00002 #define FG_SXSENT_H
00003
00004
00005 #ifdef _WIN32
00006 #define FG_COMP_OFFSET 1
00007 #else
00008 #define FG_COMP_OFFSET 0
00009 #endif
00010
00011 #include <cstdlib>
00012 #include <iostream>
00013 #include <iomanip>
00014 #include <string>
00015 #include <vector>
00016
00017 #include "fg_sxtoken.h"
00018
00019 using namespace std;
00020
00062 class SxSent
00063 {
00064
00065 public:
00066
00070 SxSent();
00074 virtual ~SxSent();
00075
00080 inline const string & getId() const;
00085 inline void setId ( const string &id );
00086
00091 inline const int getAnalyse() const;
00096 inline void setAnalyse( const int analyse );
00097
00102 inline const string & getTxt() const;
00107 inline void setTxt ( const string &txt );
00108
00114 inline bool isValid() const;
00115
00121 inline void setValid( bool bValid );
00122
00128 SxToken &getToken( unsigned int index );
00133 inline const vector<SxToken> &getAllTokens() const;
00138 inline unsigned int getNbTokens() const;
00139
00146 static void splitString( const string &s, const char delim,
00147 vector<string> &v );
00148
00163 friend istream &operator>> ( istream &is, SxSent &sent );
00164
00176 friend ostream &operator<< ( ostream &os, const SxSent &sent );
00177
00178 private:
00179
00187 istream &
00188 parseError( istream &is, const string &detail = "",
00189 const string &found = "" );
00190
00192 bool parseAnalysis( const string &analysis, string &diagnostic );
00198 bool parseRelations( const string &relations, string &diagnostic,
00199 SxToken &token, bool recteurRels );
00200
00202 bool m_bValid;
00204 string m_sId;
00206 int m_iAnalyse;
00208 string m_sTxt;
00210 vector<SxToken> m_vTokens;
00211 };
00212
00213
00214
00215 inline const string & SxSent::getId() const
00216 {
00217 return m_sId;
00218 }
00219
00220 inline void SxSent::setId (const string &id)
00221 {
00222 m_sId = id;
00223 }
00224
00225 inline const int SxSent::getAnalyse() const
00226 {
00227 return m_iAnalyse;
00228 }
00229
00230 inline void SxSent::setAnalyse( const int analyse )
00231 {
00232 m_iAnalyse = analyse;
00233 }
00234
00235 inline const string & SxSent::getTxt() const
00236 {
00237 return m_sTxt;
00238 }
00239
00240 inline void SxSent::setTxt (const string &txt)
00241 {
00242 m_sTxt = txt;
00243 }
00244
00245 inline void SxSent::setValid( bool bValid )
00246 {
00247 m_bValid = bValid;
00248 }
00249
00250 inline bool SxSent::isValid() const
00251 {
00252 return m_bValid;
00253 }
00254
00255 inline const vector<SxToken> &SxSent::getAllTokens() const
00256 {
00257 return m_vTokens;
00258 }
00259
00260 inline unsigned int SxSent::getNbTokens() const
00261 {
00262 return m_vTokens.size();
00263 }
00264
00265 #endif // ifndef FG_SXSENT_H