src: Code style corrections in Block and Buffer
Change-Id: Ic63ef97fa1e9f0d993ac2d9eb177628aa55c773a
diff --git a/src/encoding/buffer.hpp b/src/encoding/buffer.hpp
index 398817f..a97edc1 100644
--- a/src/encoding/buffer.hpp
+++ b/src/encoding/buffer.hpp
@@ -31,7 +31,7 @@
/**
* @brief Creates an empty buffer
*/
- Buffer ()
+ Buffer()
{
}
@@ -39,8 +39,9 @@
* @brief Creates a buffer with pre-allocated size
* @param size size of the buffer to be allocated
*/
- Buffer (size_t size)
- : std::vector<uint8_t> (size, 0)
+ explicit
+ Buffer(size_t size)
+ : std::vector<uint8_t>(size, 0)
{
}
@@ -49,8 +50,9 @@
* @param buf const pointer to buffer
* @param length length of the buffer to copy
*/
- Buffer (const void *buf, size_t length)
- : std::vector<uint8_t> (reinterpret_cast<const uint8_t*> (buf), reinterpret_cast<const uint8_t*> (buf) + length)
+ Buffer(const void *buf, size_t length)
+ : std::vector<uint8_t>(reinterpret_cast<const uint8_t*>(buf),
+ reinterpret_cast<const uint8_t*>(buf) + length)
{
}
@@ -63,27 +65,27 @@
* @param last iterator to an element immediately following the last element to copy
*/
template <class InputIterator>
- Buffer (InputIterator first, InputIterator last)
- : std::vector<uint8_t> (first, last)
+ Buffer(InputIterator first, InputIterator last)
+ : std::vector<uint8_t>(first, last)
{
}
/**
* @brief Get pointer to the first byte of the buffer
*/
- inline uint8_t*
- get ()
+ uint8_t*
+ get()
{
- return &front ();
+ return &front();
}
/**
* @brief Get pointer to the first byte of the buffer (alternative version)
*/
- inline uint8_t*
- buf ()
+ uint8_t*
+ buf()
{
- return &front ();
+ return &front();
}
/**
@@ -91,28 +93,28 @@
* it (reinterpret_cast) to the requested type T
*/
template<class T>
- inline T*
- get ()
+ T*
+ get()
{
- return reinterpret_cast<T *>(&front ());
+ return reinterpret_cast<T*>(&front());
}
/**
* @brief Get pointer to the first byte of the buffer (alternative version)
*/
- inline const uint8_t*
- buf () const
+ const uint8_t*
+ buf() const
{
- return &front ();
+ return &front();
}
/**
* @brief Get const pointer to the first byte of the buffer
*/
- inline const uint8_t*
- get () const
+ const uint8_t*
+ get() const
{
- return &front ();
+ return &front();
}
/**
@@ -120,10 +122,10 @@
* it (reinterpret_cast) to the requested type T
*/
template<class T>
- inline const T*
- get () const
+ const T*
+ get() const
{
- return reinterpret_cast<const T *>(&front ());
+ return reinterpret_cast<const T*>(&front());
}
};
@@ -131,20 +133,21 @@
namespace iostreams
{
-class buffer_append_device {
+class buffer_append_device
+{
public:
- typedef char char_type;
- typedef boost::iostreams::sink_tag category;
+ typedef char char_type;
+ typedef boost::iostreams::sink_tag category;
- buffer_append_device (Buffer& container)
- : m_container (container)
+ buffer_append_device(Buffer& container)
+ : m_container(container)
{
}
std::streamsize
write(const char_type* s, std::streamsize n)
{
- std::copy (s, s+n, std::back_inserter(m_container));
+ std::copy(s, s+n, std::back_inserter(m_container));
return n;
}
@@ -158,8 +161,9 @@
/**
* Class implementing interface similar to ostringstream, but to construct ndn::Buffer
*
- * The benefit of using stream interface is that it provides automatic buffering of written data
- * and eliminates (or reduces) overhead of resizing the underlying buffer when writing small pieces of data.
+ * The benefit of using stream interface is that it provides automatic buffering of
+ * written data and eliminates (or reduces) overhead of resizing the underlying buffer
+ * when writing small pieces of data.
*
* Usage example:
* @code
@@ -174,20 +178,20 @@
/**
* Default constructor
*/
- OBufferStream ()
- : m_buffer (ptr_lib::make_shared<Buffer> ())
- , m_device (*m_buffer)
+ OBufferStream()
+ : m_buffer(ptr_lib::make_shared<Buffer>())
+ , m_device(*m_buffer)
{
- open (m_device);
+ open(m_device);
}
/**
* Flush written data to the stream and return shared pointer to the underlying buffer
*/
ptr_lib::shared_ptr<Buffer>
- buf ()
+ buf()
{
- flush ();
+ flush();
return m_buffer;
}