Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1065)

Unified Diff: mojo/public/libs/message/message.h

Issue 23629032: mojo: MessageBuilder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation error. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/libs/message/README ('k') | mojo/public/libs/message/message.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/libs/message/message.h
diff --git a/mojo/public/libs/message/message.h b/mojo/public/libs/message/message.h
new file mode 100644
index 0000000000000000000000000000000000000000..94d52e63fa2532f8ba07326e6578a834d5edd732
--- /dev/null
+++ b/mojo/public/libs/message/message.h
@@ -0,0 +1,57 @@
+// Copyright 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MOJO_PUBLIC_LIBS_MESSAGE_MESSAGE_H_
+#define MOJO_PUBLIC_LIBS_MESSAGE_MESSAGE_H_
+
+#include <stdint.h>
+
+#include <vector>
+
+#include "mojo/public/system/core.h"
+
+namespace mojo {
+
+enum MessageFieldClass {
+ kMessageFieldClass_U32 = 0x1,
+ kMessageFieldClass_U64 = 0x2,
+ kMessageFieldClass_Array = 0x3,
+};
+
+enum MessageFieldType {
+ kMessageFieldType_Bool = 0x1 << 2 | kMessageFieldClass_U32,
+ kMessageFieldType_Int8 = 0x2 << 2 | kMessageFieldClass_U32,
+ kMessageFieldType_Int16 = 0x3 << 2 | kMessageFieldClass_U32,
+ kMessageFieldType_Int32 = 0x4 << 2 | kMessageFieldClass_U32,
+ kMessageFieldType_Int64 = 0x5 << 2 | kMessageFieldClass_U64,
+ kMessageFieldType_Uint8 = 0x6 << 2 | kMessageFieldClass_U32,
+ kMessageFieldType_Uint16 = 0x7 << 2 | kMessageFieldClass_U32,
+ kMessageFieldType_Uint32 = 0x8 << 2 | kMessageFieldClass_U32,
+ kMessageFieldType_Uint64 = 0x9 << 2 | kMessageFieldClass_U64,
+ kMessageFieldType_Float = 0xA << 2 | kMessageFieldClass_U32,
+ kMessageFieldType_Double = 0xB << 2 | kMessageFieldClass_U64,
+ kMessageFieldType_String = 0xC << 2 | kMessageFieldClass_Array,
+ kMessageFieldType_Bytes = 0xD << 2 | kMessageFieldClass_Array,
+ kMessageFieldType_Handle = 0xE << 2 | kMessageFieldClass_U32,
+ kMessageFieldType_Message = 0xF << 2 | kMessageFieldClass_Array,
+};
+
+class Message {
+ public:
+ Message();
+ ~Message();
+
+ const std::vector<uint8_t>& data() const { return data_; }
+ const std::vector<Handle>& handles() const { return handles_; }
+
+ private:
+ friend class MessageBuilder;
+
+ std::vector<uint8_t> data_;
+ std::vector<Handle> handles_;
+};
+
+} // namespace mojo
+
+#endif // MOJO_PUBLIC_LIBS_MESSAGE_MESSAGE_H_
« no previous file with comments | « mojo/public/libs/message/README ('k') | mojo/public/libs/message/message.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698