Merge pull request #1844 from jrw972/monterey
[ACE_TAO.git] / ACE / apps / JAWS2 / JAWS / Headers.h
blob54d4ede3231c03d90dbbede0fab22cc0b62819ba
1 /* -*- c++ -*- */
2 #ifndef JAWS_HEADERS_H
3 #define JAWS_HEADERS_H
5 #include "JAWS/Export.h"
6 #include "ace/Containers.h"
8 #if !defined (ACE_LACKS_PRAGMA_ONCE)
9 # pragma once
10 #endif /* ACE_LACKS_PRAGMA_ONCE */
12 // Use scenario --
14 // Parse_Headers will parse out a header name and then will want to
15 // update "last header data" in Header_Info. At this point, only the
16 // header name is strdup'd.
18 // Parse_Headers will then append additional data to the header value
19 // until the header value of "last header data" is done.
21 // Parse_Headers will notify Header_Info that "last header data" is
22 // done and is ready to be inserted into the Headers data structure.
23 // At this point, the header value is strdup'd.
25 class JAWS_Export JAWS_Header_Data
27 public:
28 JAWS_Header_Data (const char *name, const char *value = 0, int type = 0);
29 JAWS_Header_Data (const char *name, int type, const char *value = 0);
30 ~JAWS_Header_Data (void);
32 const char * header_name (void) const;
33 const char * header_value (void) const;
34 int header_type (void) const;
36 void header_name (const char *name);
37 void header_value (const char *value);
38 void header_type (int type);
40 private:
41 const char * header_name_;
42 const char * header_value_;
43 int header_type_;
46 typedef ACE_DLList<JAWS_Header_Data> JAWS_Header_Table;
47 typedef ACE_DLList_Iterator<JAWS_Header_Data> JAWS_Header_Table_Iterator;
49 class JAWS_Export JAWS_Headers : public JAWS_Header_Table
51 public:
52 JAWS_Headers (void);
53 ~JAWS_Headers (void);
55 int insert (JAWS_Header_Data *new_data);
56 // insert the new data 0 -> success, -1 -> failure
58 JAWS_Header_Data * find (const char *const &header_name);
59 // find always begins from the beginning of the list
60 // result is NULL if not found
62 JAWS_Header_Data * find_next (const char *const &header_name);
63 // behaves like find, but from where that last find left off
64 // result is NULL if not found
66 void remove_all (const char *const &header_name);
67 // remove all headers from list that match header_name
69 JAWS_Header_Table_Iterator &iter (void);
70 // returns an iterator to the headers container
72 private:
73 JAWS_Header_Table_Iterator iter_;
76 #endif /* !defined (JAWS_HEADERS_H) */