Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET Apache Qpid Documentation
FileProperties.h
Go to the documentation of this file.
1 #ifndef QPID_FRAMING_FILEPROPERTIES_H
2 #define QPID_FRAMING_FILEPROPERTIES_H
3 /*
4  *
5  * Licensed to the Apache Software Foundation (ASF) under one
6  * or more contributor license agreements. See the NOTICE file
7  * distributed with this work for additional information
8  * regarding copyright ownership. The ASF licenses this file
9  * to you under the Apache License, Version 2.0 (the
10  * "License"); you may not use this file except in compliance
11  * with the License. You may obtain a copy of the License at
12  *
13  * http://www.apache.org/licenses/LICENSE-2.0
14  *
15  * Unless required by applicable law or agreed to in writing,
16  * software distributed under the License is distributed on an
17  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18  * KIND, either express or implied. See the License for the
19  * specific language governing permissions and limitations
20  * under the License.
21  *
22  */
23 
28 
29 
30 
31 #include <ostream>
32 #include "qpid/framing/amqp_types_full.h"
34 #include "qpid/CommonImportExport.h"
35 
36 namespace qpid {
37 namespace framing {
38 
39 class QPID_COMMON_CLASS_EXTERN FileProperties {
40  std::string contentType;
41  std::string contentEncoding;
42  FieldTable headers;
43  uint8_t priority;
44  std::string replyTo;
45  std::string messageId;
46  std::string filename;
47  uint64_t timestamp;
48  std::string clusterId;
49  uint16_t flags;
50 public:
51  static const uint16_t TYPE = 2305;
53  const std::string& _contentType,
54  const std::string& _contentEncoding,
55  const FieldTable& _headers,
56  uint8_t _priority,
57  const std::string& _replyTo,
58  const std::string& _messageId,
59  const std::string& _filename,
60  uint64_t _timestamp,
61  const std::string& _clusterId) :
62  contentType(_contentType),
63  contentEncoding(_contentEncoding),
64  headers(_headers),
65  priority(_priority),
66  replyTo(_replyTo),
67  messageId(_messageId),
68  filename(_filename),
69  timestamp(_timestamp),
70  clusterId(_clusterId),
71  flags(0){
72  flags |= (1 << 8);
73  flags |= (1 << 9);
74  flags |= (1 << 10);
75  flags |= (1 << 11);
76  flags |= (1 << 12);
77  flags |= (1 << 13);
78  flags |= (1 << 14);
79  flags |= (1 << 15);
80  flags |= (1 << 0);
81  if (contentType.size() >= 256) throw IllegalArgumentException("Value for contentType is too large");
82  if (contentEncoding.size() >= 256) throw IllegalArgumentException("Value for contentEncoding is too large");
83  if (replyTo.size() >= 256) throw IllegalArgumentException("Value for replyTo is too large");
84  if (messageId.size() >= 256) throw IllegalArgumentException("Value for messageId is too large");
85  if (filename.size() >= 256) throw IllegalArgumentException("Value for filename is too large");
86  if (clusterId.size() >= 256) throw IllegalArgumentException("Value for clusterId is too large");
87  }
88  FileProperties() : priority(0), timestamp(0), flags(0) {}
89 
90  QPID_COMMON_EXTERN void setContentType(const std::string& _contentType);
91  QPID_COMMON_EXTERN const std::string& getContentType() const;
92  QPID_COMMON_EXTERN bool hasContentType() const;
93  QPID_COMMON_EXTERN void clearContentTypeFlag();
94  QPID_COMMON_EXTERN void setContentEncoding(const std::string& _contentEncoding);
95  QPID_COMMON_EXTERN const std::string& getContentEncoding() const;
96  QPID_COMMON_EXTERN bool hasContentEncoding() const;
97  QPID_COMMON_EXTERN void clearContentEncodingFlag();
98  QPID_COMMON_EXTERN void setHeaders(const FieldTable& _headers);
99  QPID_COMMON_EXTERN const FieldTable& getHeaders() const;
100  QPID_COMMON_EXTERN FieldTable& getHeaders();
101  QPID_COMMON_EXTERN bool hasHeaders() const;
102  QPID_COMMON_EXTERN void clearHeadersFlag();
103  QPID_COMMON_EXTERN void setPriority(uint8_t _priority);
104  QPID_COMMON_EXTERN uint8_t getPriority() const;
105  QPID_COMMON_EXTERN bool hasPriority() const;
106  QPID_COMMON_EXTERN void clearPriorityFlag();
107  QPID_COMMON_EXTERN void setReplyTo(const std::string& _replyTo);
108  QPID_COMMON_EXTERN const std::string& getReplyTo() const;
109  QPID_COMMON_EXTERN bool hasReplyTo() const;
110  QPID_COMMON_EXTERN void clearReplyToFlag();
111  QPID_COMMON_EXTERN void setMessageId(const std::string& _messageId);
112  QPID_COMMON_EXTERN const std::string& getMessageId() const;
113  QPID_COMMON_EXTERN bool hasMessageId() const;
114  QPID_COMMON_EXTERN void clearMessageIdFlag();
115  QPID_COMMON_EXTERN void setFilename(const std::string& _filename);
116  QPID_COMMON_EXTERN const std::string& getFilename() const;
117  QPID_COMMON_EXTERN bool hasFilename() const;
118  QPID_COMMON_EXTERN void clearFilenameFlag();
119  QPID_COMMON_EXTERN void setTimestamp(uint64_t _timestamp);
120  QPID_COMMON_EXTERN uint64_t getTimestamp() const;
121  QPID_COMMON_EXTERN bool hasTimestamp() const;
122  QPID_COMMON_EXTERN void clearTimestampFlag();
123  QPID_COMMON_EXTERN void setClusterId(const std::string& _clusterId);
124  QPID_COMMON_EXTERN const std::string& getClusterId() const;
125  QPID_COMMON_EXTERN bool hasClusterId() const;
126  QPID_COMMON_EXTERN void clearClusterIdFlag();
127  QPID_COMMON_EXTERN friend std::ostream& operator<<(std::ostream&, const FileProperties&);
128  QPID_COMMON_EXTERN void encode(Buffer&) const;
129  QPID_COMMON_EXTERN void decode(Buffer&, uint32_t=0);
130  QPID_COMMON_EXTERN void encodeStructBody(Buffer&) const;
131  QPID_COMMON_EXTERN void decodeStructBody(Buffer&, uint32_t=0);
132  QPID_COMMON_EXTERN uint32_t encodedSize() const;
133  QPID_COMMON_EXTERN uint32_t bodySize() const;
134  QPID_COMMON_EXTERN void print(std::ostream& out) const;
135 }; /* class FileProperties */
136 
137 }}
138 #endif
unsigned char uint8_t
Definition: IntegerTypes.h:24
FileProperties(const std::string &_contentType, const std::string &_contentEncoding, const FieldTable &_headers, uint8_t _priority, const std::string &_replyTo, const std::string &_messageId, const std::string &_filename, uint64_t _timestamp, const std::string &_clusterId)
std::ostream & operator<<(std::ostream &, TypeCode)
void decode(const Message &message, qpid::types::Variant::Map &map, const std::string &encoding=std::string())
Decodes message content into a Variant::Map.
unsigned int uint32_t
Definition: IntegerTypes.h:27
unsigned short uint16_t
Definition: IntegerTypes.h:25
void encode(const qpid::types::Variant::Map &map, Message &message, const std::string &encoding=std::string())
Encodes a Variant::Map into a message.

Qpid C++ API Reference
Generated on Tue Oct 28 2014 for Qpid C++ Client API by doxygen 1.8.5