~ubuntu-branches/ubuntu/trusty/newsbeuter/trusty-proposed

« back to all changes in this revision

Viewing changes to include/tagsouppullparser.h

  • Committer: Bazaar Package Importer
  • Author(s): Nico Golde
  • Date: 2008-05-01 14:51:20 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20080501145120-i65avsclnrpl2cfq
Tags: 0.9-1
* New upstream release.
  - Fix problem displaying titles when using zh_CN.UTF-8
    locale (Closes: #471434).
* Add default configuration to set sensible-browser as browser and
  add dirs file to create /etc/newsbeuter (Closes: #470833).
* remove libnxml-depends and libmrss-depends calls in rules and
  related dependency lines in control since they are not needed
  anymore (Closes: #467201).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef tagsouppullparser_H_
 
2
#define tagsouppullparser_H_
 
3
 
 
4
#include <string>
 
5
#include <utility>
 
6
#include <vector>
 
7
 
 
8
namespace newsbeuter
 
9
{
 
10
 
 
11
class tagsouppullparser
 
12
{
 
13
public:
 
14
        enum event { START_DOCUMENT, END_DOCUMENT, START_TAG, END_TAG, TEXT };
 
15
        
 
16
        tagsouppullparser();
 
17
        virtual ~tagsouppullparser();
 
18
        void setInput(std::istream& is);
 
19
        int getAttributeCount() const;
 
20
        std::string getAttributeName(unsigned int index) const;
 
21
        std::string getAttributeValue(unsigned int index) const;
 
22
        std::string getAttributeValue(const std::string& name) const;
 
23
        event getEventType() const;
 
24
        std::string getText() const;
 
25
        bool isWhitespace() const;
 
26
        event next();
 
27
        
 
28
private:
 
29
        typedef std::pair<std::string,std::string> attribute;
 
30
        std::vector<attribute> attributes;
 
31
        std::string text;
 
32
        std::istream * inputstream;
 
33
        event current_event;
 
34
        
 
35
        int skip_whitespace(std::string& ws);
 
36
        void add_attribute(std::string s);
 
37
        std::string read_tag();
 
38
        event determine_tag_type();
 
39
        std::string decode_attribute(const std::string& s);
 
40
        std::string decode_entities(const std::string& s);
 
41
        std::string decode_entity(std::string s);
 
42
        void remove_trailing_whitespace(std::string& s);
 
43
 
 
44
        
 
45
};
 
46
 
 
47
}
 
48
 
 
49
#endif /*tagsouppullparser_H_*/