summaryrefslogtreecommitdiff
path: root/qpid/cpp/include/qpid/messaging/Message.h
blob: 4477d5a2e99497110d78ae4004bcc47c6a24ccc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#ifndef QPID_MESSAGING_MESSAGE_H
#define QPID_MESSAGING_MESSAGE_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 <string>
#include "qpid/messaging/Variant.h"
#include "qpid/client/ClientImportExport.h"

namespace qpid {
namespace client {
}

namespace messaging {

struct Address;
class Codec;
struct MessageImpl;

/**
 * Representation of a message.
 */
class Message
{
  public:
    QPID_CLIENT_EXTERN Message(const std::string& bytes = std::string());
    QPID_CLIENT_EXTERN Message(const char*, size_t);
    QPID_CLIENT_EXTERN Message(const Message&);
    QPID_CLIENT_EXTERN ~Message();

    QPID_CLIENT_EXTERN Message& operator=(const Message&);

    QPID_CLIENT_EXTERN void setReplyTo(const Address&);
    QPID_CLIENT_EXTERN const Address& getReplyTo() const;

    QPID_CLIENT_EXTERN void setSubject(const std::string&);
    QPID_CLIENT_EXTERN const std::string& getSubject() const;

    QPID_CLIENT_EXTERN void setContentType(const std::string&);
    QPID_CLIENT_EXTERN const std::string& getContentType() const;

    QPID_CLIENT_EXTERN const VariantMap& getHeaders() const;
    QPID_CLIENT_EXTERN VariantMap& getHeaders();

    QPID_CLIENT_EXTERN const std::string& getContent() const;
    QPID_CLIENT_EXTERN std::string& getContent();
    QPID_CLIENT_EXTERN void setContent(const std::string&);
    QPID_CLIENT_EXTERN void setContent(const char* chars, size_t count);
    QPID_CLIENT_EXTERN void getContent(std::pair<const char*, size_t>& content) const;

  private:
    MessageImpl* impl;
    friend struct MessageImplAccess;
};
}} // namespace qpid::messaging

#endif  /*!QPID_MESSAGING_MESSAGE_H*/