sipxtacklib  Version 3.3
MimeBodyPart.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2004-2007 SIPfoundry Inc.
3 // Licensed by SIPfoundry under the LGPL license.
4 //
5 // Copyright (C) 2004-2006 Pingtel Corp. All rights reserved.
6 // Licensed to SIPfoundry under a Contributor Agreement.
7 //
8 // $$
10 
11 
12 #ifndef _MimeBodyPart_h_
13 #define _MimeBodyPart_h_
14 
15 // SYSTEM INCLUDES
16 //#include <...>
17 #include "utl/UtlDList.h"
18 
19 // APPLICATION INCLUDES
20 #include <net/HttpBody.h>
21 
22 
23 // DEFINES
24 // MACROS
25 // EXTERNAL FUNCTIONS
26 // EXTERNAL VARIABLES
27 // CONSTANTS
28 // STRUCTS
29 // TYPEDEFS
30 // FORWARD DECLARATIONS
31 
32 //:One part of a multipart Mime body
33 // This is a child part of a multipart MIME body
34 class MimeBodyPart : public HttpBody
35 {
36 /* //////////////////////////// PUBLIC //////////////////////////////////// */
37 public:
38 
39 /* ============================ CREATORS ================================== */
40 
41  MimeBodyPart(const HttpBody* parent = NULL,
42  int parentBodyStartIndex = 0,
43  int rawBodyLength = 0);
44  //:Default constructor
45 
47  MimeBodyPart(const HttpBody& httpBody,
48  //< Provides the bytes of the body.
49  const UtlDList& parameters
50  //< Provides the parameters.
51  );
56  MimeBodyPart(const MimeBodyPart& rMimeBodyPart);
57  //:Copy constructor
58 
59  virtual
60  ~MimeBodyPart();
61  //:Destructor
62 
63 /* ============================ MANIPULATORS ============================== */
64 
65  MimeBodyPart& operator=(const MimeBodyPart& rhs);
66  //:Assignment operator
67 
71  void attach(HttpBody* parent,
72  int rawPartStart, int rawPartLength,
73  int partStart, int partLength);
74 
75 /* ============================ ACCESSORS ================================= */
76 
77  // Get the various indexes from the object.
78  int getRawStart() const;
79  int getRawLength() const;
80  int getStart() const;
81  int getLength() const;
82 
83  virtual void getBytes(const char** bytes, int* length) const;
84 
85  UtlBoolean getPartHeaderValue(const char* headerName,
86  UtlString& headerValue) const;
87 
88  UtlDList* getParameters();
89 
90 /* ============================ INQUIRY =================================== */
91 
92 /* //////////////////////////// PROTECTED ///////////////////////////////// */
93 protected:
94 
95 /* //////////////////////////// PRIVATE /////////////////////////////////// */
96 private:
97  UtlDList mNameValues;
98  const HttpBody* mpParentBody;
99  int mParentBodyRawStartIndex;
100  int mRawBodyLength;
101  int mParentBodyStartIndex;
102  int mBodyLength;
103 
104 };
105 
106 /* ============================ INLINE METHODS ============================ */
107 
108 inline int MimeBodyPart::getRawStart() const
109 {
110  return mParentBodyRawStartIndex;
111 }
112 
113 inline int MimeBodyPart::getRawLength() const
114 {
115  return mRawBodyLength;
116 }
117 
118 inline int MimeBodyPart::getStart() const
119 {
120  return mParentBodyStartIndex;
121 }
122 
123 inline int MimeBodyPart::getLength() const
124 {
125  return mBodyLength;
126 }
127 
128 inline UtlDList* MimeBodyPart::getParameters()
129 {
130  return &mNameValues;
131 }
132 
133 #endif // _MimeBodyPart_h_
void attach(HttpBody *parent, int rawPartStart, int rawPartLength, int partStart, int partLength)
Update the members that locate this MimeBodyPart within its parent HttpBody.
Definition: MimeBodyPart.cpp:153
virtual const char * getBytes() const
Definition: HttpBody.cpp:476
UtlBoolean getPartHeaderValue(const char *headerName, UtlString &headerValue) const
Definition: MimeBodyPart.cpp:182
MimeBodyPart(const HttpBody *parent=NULL, int parentBodyStartIndex=0, int rawBodyLength=0)
Definition: MimeBodyPart.cpp:30
int getLength() const
Definition: MimeBodyPart.h:123
MimeBodyPart & operator=(const MimeBodyPart &rhs)
Definition: MimeBodyPart.cpp:129
virtual ~MimeBodyPart()
Definition: MimeBodyPart.cpp:120
int getStart() const
Definition: MimeBodyPart.h:118
int getRawStart() const
Definition: MimeBodyPart.h:108
class to contain an HTTP body
Definition: HttpBody.h:55
Definition: MimeBodyPart.h:34
int getRawLength() const
Definition: MimeBodyPart.h:113
UtlDList * getParameters()
Definition: MimeBodyPart.h:128

sipXtackLib home page