[Groonga-commit] groonga/grnxx [master] Add output functions for flags.

Back to archive index

susumu.yata null+****@clear*****
Fri Dec 7 11:26:16 JST 2012


susumu.yata	2012-12-07 11:26:16 +0900 (Fri, 07 Dec 2012)

  New Revision: 11aa3f9f39e8b41cadc049c52c4789866761cac2
  https://github.com/groonga/grnxx/commit/11aa3f9f39e8b41cadc049c52c4789866761cac2

  Log:
    Add output functions for flags.

  Modified files:
    lib/io/file.cpp
    lib/io/file.hpp
    lib/io/pool.cpp
    lib/io/pool.hpp
    lib/io/view.cpp
    lib/io/view.hpp

  Modified: lib/io/file.cpp (+9 -0)
===================================================================
--- lib/io/file.cpp    2012-12-07 09:56:21 +0900 (bf14ce5)
+++ lib/io/file.cpp    2012-12-07 11:26:16 +0900 (096bcbc)
@@ -19,6 +19,8 @@
 #include "file-posix.hpp"
 #include "file-windows.hpp"
 
+#include <ostream>
+
 #include "../exception.hpp"
 #include "../logger.hpp"
 
@@ -51,6 +53,13 @@ StringBuilder &operator<<(StringBuilder &builder, FileFlags flags) {
   }
 }
 
+std::ostream &operator<<(std::ostream &stream, FileFlags flags) {
+  char buf[256];
+  StringBuilder builder(buf);
+  builder << flags;
+  return stream.write(builder.c_str(), builder.length());
+}
+
 File::File() : impl_() {}
 
 File::File(FileFlags flags, const char *path, int permission)

  Modified: lib/io/file.hpp (+1 -0)
===================================================================
--- lib/io/file.hpp    2012-12-07 09:56:21 +0900 (b400976)
+++ lib/io/file.hpp    2012-12-07 11:26:16 +0900 (aeff6b7)
@@ -58,6 +58,7 @@ constexpr FileFlags FILE_TEMPORARY      = FileFlags::define(0x0200);
 constexpr FileFlags FILE_TRUNCATE       = FileFlags::define(0x0400);
 
 StringBuilder &operator<<(StringBuilder &builder, FileFlags flags);
+std::ostream &operator<<(std::ostream &builder, FileFlags flags);
 
 enum FileLockMode {
   FILE_LOCK_EXCLUSIVE = 0x1000,  // Create an exclusive lock.

  Modified: lib/io/pool.cpp (+9 -0)
===================================================================
--- lib/io/pool.cpp    2012-12-07 09:56:21 +0900 (80fe107)
+++ lib/io/pool.cpp    2012-12-07 11:26:16 +0900 (2dcc4cc)
@@ -17,6 +17,8 @@
 */
 #include "pool-impl.hpp"
 
+#include <ostream>
+
 #include "../exception.hpp"
 #include "../logger.hpp"
 
@@ -48,6 +50,13 @@ StringBuilder &operator<<(StringBuilder &builder, PoolFlags flags) {
   }
 }
 
+std::ostream &operator<<(std::ostream &stream, PoolFlags flags) {
+  char buf[256];
+  StringBuilder builder(buf);
+  builder << flags;
+  return stream.write(builder.c_str(), builder.length());
+}
+
 PoolOptions::PoolOptions()
   : max_block_size_(0),
     min_block_chunk_size_(0),

  Modified: lib/io/pool.hpp (+1 -0)
===================================================================
--- lib/io/pool.hpp    2012-12-07 09:56:21 +0900 (d0877c5)
+++ lib/io/pool.hpp    2012-12-07 11:26:16 +0900 (786204e)
@@ -89,6 +89,7 @@ const PoolFlags POOL_CREATE_OR_OPEN = PoolFlags::define(0x0040);
 const PoolFlags POOL_TEMPORARY      = PoolFlags::define(0x0200);
 
 StringBuilder &operator<<(StringBuilder &builder, PoolFlags flags);
+std::ostream &operator<<(std::ostream &builder, PoolFlags flags);
 
 class PoolOptions {
  public:

  Modified: lib/io/view.cpp (+9 -0)
===================================================================
--- lib/io/view.cpp    2012-12-07 09:56:21 +0900 (eec0fa1)
+++ lib/io/view.cpp    2012-12-07 11:26:16 +0900 (1e49e30)
@@ -19,6 +19,8 @@
 #include "view-posix.hpp"
 #include "view-windows.hpp"
 
+#include <ostream>
+
 #include "../exception.hpp"
 #include "../logger.hpp"
 
@@ -50,6 +52,13 @@ StringBuilder &operator<<(StringBuilder &builder, ViewFlags flags) {
   }
 }
 
+std::ostream &operator<<(std::ostream &stream, ViewFlags flags) {
+  char buf[256];
+  StringBuilder builder(buf);
+  builder << flags;
+  return stream.write(builder.c_str(), builder.length());
+}
+
 View::View() : impl_() {}
 
 View::View(ViewFlags flags, uint64_t size)

  Modified: lib/io/view.hpp (+1 -0)
===================================================================
--- lib/io/view.hpp    2012-12-07 09:56:21 +0900 (33cb8e2)
+++ lib/io/view.hpp    2012-12-07 11:26:16 +0900 (eef1db2)
@@ -52,6 +52,7 @@ const ViewFlags VIEW_PRIVATE    = ViewFlags::define(0x1000);
 const ViewFlags VIEW_SHARED     = ViewFlags::define(0x2000);
 
 StringBuilder &operator<<(StringBuilder &builder, ViewFlags flags);
+std::ostream &operator<<(std::ostream &builder, ViewFlags flags);
 
 class ViewImpl;
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index