encoding: Improving structure and documentation of block helpers
This commit add several new helpers to simplify operations with
std::string:
- prependStringBlock
- makeStringBlock
- readString
The following functions are deprecated and their replacements:
- nonNegativeIntegerBlock (use makeNonNegativeIntegerBlock)
- prependBooleanBlock (use prependEmptyBlock)
- booleanBlock (use makeEmptyBlock)
- dataBlock (use makeBinaryBlock)
- nestedBlock (use makeNestedBlock)
Change-Id: Ic595ae64fc9c80c2c04e5fde1d8812e8b9debd60
Refs: #2951
diff --git a/src/management/nfd-control-response.cpp b/src/management/nfd-control-response.cpp
index 6de873f..0c2166c 100644
--- a/src/management/nfd-control-response.cpp
+++ b/src/management/nfd-control-response.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2013-2014 Regents of the University of California.
+ * Copyright (c) 2013-2015 Regents of the University of California.
*
* This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
*
@@ -22,7 +22,6 @@
#include "nfd-control-response.hpp"
#include "encoding/tlv-nfd.hpp"
#include "encoding/block-helpers.hpp"
-#include "util/concepts.hpp"
namespace ndn {
namespace nfd {
@@ -56,16 +55,13 @@
return m_wire;
m_wire = Block(tlv::nfd::ControlResponse);
- m_wire.push_back
- (nonNegativeIntegerBlock(tlv::nfd::StatusCode, m_code));
+ m_wire.push_back(makeNonNegativeIntegerBlock(tlv::nfd::StatusCode, m_code));
- m_wire.push_back
- (dataBlock(tlv::nfd::StatusText, m_text.c_str(), m_text.size()));
+ m_wire.push_back(makeBinaryBlock(tlv::nfd::StatusText, m_text.c_str(), m_text.size()));
- if (m_body.hasWire())
- {
- m_wire.push_back(m_body);
- }
+ if (m_body.hasWire()) {
+ m_wire.push_back(m_body);
+ }
m_wire.encode();
return m_wire;