diff options
| author | Gordon Sim <gsim@apache.org> | 2009-08-25 17:57:34 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2009-08-25 17:57:34 +0000 |
| commit | 082fa377137d1a73382a0c3f1ab22b5abe6cb485 (patch) | |
| tree | 27375051e0f05a91ff63f123b2b027916840221c /cpp/include/qpid/messaging/MessageContent.h | |
| parent | 28e1de98b115ebc834a1e232bfd630809689a59e (diff) | |
| download | qpid-python-082fa377137d1a73382a0c3f1ab22b5abe6cb485.tar.gz | |
QPID-664: Initial checkin of high level messaging api for c++
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@807731 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/include/qpid/messaging/MessageContent.h')
| -rw-r--r-- | cpp/include/qpid/messaging/MessageContent.h | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/cpp/include/qpid/messaging/MessageContent.h b/cpp/include/qpid/messaging/MessageContent.h new file mode 100644 index 0000000000..7c3a636c07 --- /dev/null +++ b/cpp/include/qpid/messaging/MessageContent.h @@ -0,0 +1,90 @@ +#ifndef QPID_MESSAGING_MESSAGECONTENT_H +#define QPID_MESSAGING_MESSAGECONTENT_H + +/* + * + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + * + */ + +#include "qpid/messaging/Variant.h" +#include <string> +#include "qpid/client/ClientImportExport.h" + +namespace qpid { +namespace messaging { + +/** + * + */ +class MessageContent +{ + public: + QPID_CLIENT_EXTERN virtual ~MessageContent() {} + + virtual const std::string& asString() const = 0; + virtual std::string& asString() = 0; + + virtual const char* asChars() const = 0; + virtual size_t size() const = 0; + + virtual const Variant::Map& asMap() const = 0; + virtual Variant::Map& asMap() = 0; + virtual bool isMap() const = 0; + + virtual const Variant::List& asList() const = 0; + virtual Variant::List& asList() = 0; + virtual bool isList() const = 0; + + virtual void clear() = 0; + + virtual Variant& operator[](const std::string&) = 0; + + + virtual std::ostream& print(std::ostream& out) const = 0; + + + //operator<< for variety of types... (is this a good idea?) + virtual MessageContent& operator<<(const std::string&) = 0; + virtual MessageContent& operator<<(const char*) = 0; + virtual MessageContent& operator<<(bool) = 0; + virtual MessageContent& operator<<(int8_t) = 0; + virtual MessageContent& operator<<(int16_t) = 0; + virtual MessageContent& operator<<(int32_t) = 0; + virtual MessageContent& operator<<(int64_t) = 0; + virtual MessageContent& operator<<(uint8_t) = 0; + virtual MessageContent& operator<<(uint16_t) = 0; + virtual MessageContent& operator<<(uint32_t) = 0; + virtual MessageContent& operator<<(uint64_t) = 0; + virtual MessageContent& operator<<(double) = 0; + virtual MessageContent& operator<<(float) = 0; + + //assignment from string, map and list + virtual MessageContent& operator=(const std::string&) = 0; + virtual MessageContent& operator=(const char*) = 0; + virtual MessageContent& operator=(const Variant::Map&) = 0; + virtual MessageContent& operator=(const Variant::List&) = 0; + + private: +}; + +QPID_CLIENT_EXTERN std::ostream& operator<<(std::ostream& out, const MessageContent& content); + +}} // namespace qpid::messaging + +#endif /*!QPID_MESSAGING_MESSAGECONTENT_H*/ |
