src: Avoid use of `detail` folder for installable headers

This commit moves `lp/detail/*` to `lp/`, as `detail` folders should
include only private APIs that are only used during the build and cannot
be used (header files not installed) by external applications.

Change-Id: I370592819c4bc5f4016689ef7c9c5bd2cdd0eaa2
diff --git a/src/lp/detail/field-decl.hpp b/src/lp/field-decl.hpp
similarity index 91%
rename from src/lp/detail/field-decl.hpp
rename to src/lp/field-decl.hpp
index 792a340..a71aceb 100644
--- a/src/lp/detail/field-decl.hpp
+++ b/src/lp/field-decl.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -19,19 +19,18 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_CXX_LP_DETAIL_FIELD_DECL_HPP
-#define NDN_CXX_LP_DETAIL_FIELD_DECL_HPP
+#ifndef NDN_CXX_LP_FIELD_DECL_HPP
+#define NDN_CXX_LP_FIELD_DECL_HPP
 
-#include "../field.hpp"
-#include "../tlv.hpp"
+#include "field.hpp"
+#include "tlv.hpp"
 
-#include "../../encoding/block-helpers.hpp"
-#include "../../util/concepts.hpp"
+#include "../encoding/block-helpers.hpp"
+#include "../util/concepts.hpp"
 #include <boost/concept/requires.hpp>
 
 namespace ndn {
 namespace lp {
-namespace detail {
 
 template<typename TlvType, typename T>
 struct DecodeHelper
@@ -140,8 +139,7 @@
   }
 };
 
-} // namespace detail
 } // namespace lp
 } // namespace ndn
 
-#endif // NDN_CXX_LP_DETAIL_FIELD_DECL_HPP
+#endif // NDN_CXX_LP_FIELD_DECL_HPP
diff --git a/src/lp/detail/field-info.cpp b/src/lp/field-info.cpp
similarity index 94%
rename from src/lp/detail/field-info.cpp
rename to src/lp/field-info.cpp
index f2eca34..99b0b0b 100644
--- a/src/lp/detail/field-info.cpp
+++ b/src/lp/field-info.cpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2016 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -26,7 +26,6 @@
 
 namespace ndn {
 namespace lp {
-namespace detail {
 
 struct ExtractFieldInfo
 {
@@ -69,6 +68,5 @@
   }
 }
 
-} // namespace detail
 } // namespace lp
 } // namespace ndn
diff --git a/src/lp/detail/field-info.hpp b/src/lp/field-info.hpp
similarity index 87%
rename from src/lp/detail/field-info.hpp
rename to src/lp/field-info.hpp
index 2ee0e10..5cb618c 100644
--- a/src/lp/detail/field-info.hpp
+++ b/src/lp/field-info.hpp
@@ -1,6 +1,6 @@
 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
 /**
- * Copyright (c) 2013-2015 Regents of the University of California.
+ * Copyright (c) 2013-2017 Regents of the University of California.
  *
  * This file is part of ndn-cxx library (NDN C++ library with eXperimental eXtensions).
  *
@@ -19,16 +19,15 @@
  * See AUTHORS.md for complete list of ndn-cxx authors and contributors.
  */
 
-#ifndef NDN_CXX_LP_DETAIL_FIELD_INFO_HPP
-#define NDN_CXX_LP_DETAIL_FIELD_INFO_HPP
+#ifndef NDN_CXX_LP_FIELD_INFO_HPP
+#define NDN_CXX_LP_FIELD_INFO_HPP
 
-#include "../../common.hpp"
+#include "../common.hpp"
 
-#include "../fields.hpp"
+#include "fields.hpp"
 
 namespace ndn {
 namespace lp {
-namespace detail {
 
 class FieldInfo
 {
@@ -90,8 +89,7 @@
          (first.locationSortOrder == second.locationSortOrder && first.tlvType < second.tlvType);
 }
 
-} // namespace detail
 } // namespace lp
 } // namespace ndn
 
-#endif // NDN_CXX_LP_DETAIL_FIELD_INFO_HPP
\ No newline at end of file
+#endif // NDN_CXX_LP_FIELD_INFO_HPP
diff --git a/src/lp/fields.hpp b/src/lp/fields.hpp
index caa2337..5612b16 100644
--- a/src/lp/fields.hpp
+++ b/src/lp/fields.hpp
@@ -22,7 +22,7 @@
 #ifndef NDN_CXX_LP_FIELDS_HPP
 #define NDN_CXX_LP_FIELDS_HPP
 
-#include "detail/field-decl.hpp"
+#include "field-decl.hpp"
 
 #include "sequence.hpp"
 #include "cache-policy.hpp"
@@ -33,64 +33,64 @@
 namespace ndn {
 namespace lp {
 
-typedef detail::FieldDecl<field_location_tags::Header,
-                          Sequence,
-                          tlv::Sequence> SequenceField;
+typedef FieldDecl<field_location_tags::Header,
+                  Sequence,
+                  tlv::Sequence> SequenceField;
 BOOST_CONCEPT_ASSERT((Field<SequenceField>));
 
-typedef detail::FieldDecl<field_location_tags::Header,
-                          uint64_t,
-                          tlv::FragIndex> FragIndexField;
+typedef FieldDecl<field_location_tags::Header,
+                  uint64_t,
+                  tlv::FragIndex> FragIndexField;
 BOOST_CONCEPT_ASSERT((Field<FragIndexField>));
 
-typedef detail::FieldDecl<field_location_tags::Header,
-                          uint64_t,
-                          tlv::FragCount> FragCountField;
+typedef FieldDecl<field_location_tags::Header,
+                  uint64_t,
+                  tlv::FragCount> FragCountField;
 BOOST_CONCEPT_ASSERT((Field<FragCountField>));
 
-typedef detail::FieldDecl<field_location_tags::Header,
-                          NackHeader,
-                          tlv::Nack> NackField;
+typedef FieldDecl<field_location_tags::Header,
+                  NackHeader,
+                  tlv::Nack> NackField;
 BOOST_CONCEPT_ASSERT((Field<NackField>));
 
-typedef detail::FieldDecl<field_location_tags::Header,
-                          uint64_t,
-                          tlv::NextHopFaceId> NextHopFaceIdField;
+typedef FieldDecl<field_location_tags::Header,
+                  uint64_t,
+                  tlv::NextHopFaceId> NextHopFaceIdField;
 BOOST_CONCEPT_ASSERT((Field<NextHopFaceIdField>));
 
-typedef detail::FieldDecl<field_location_tags::Header,
-                          CachePolicy,
-                          tlv::CachePolicy> CachePolicyField;
+typedef FieldDecl<field_location_tags::Header,
+                  CachePolicy,
+                  tlv::CachePolicy> CachePolicyField;
 BOOST_CONCEPT_ASSERT((Field<CachePolicyField>));
 
-typedef detail::FieldDecl<field_location_tags::Header,
-                          uint64_t,
-                          tlv::IncomingFaceId> IncomingFaceIdField;
+typedef FieldDecl<field_location_tags::Header,
+                  uint64_t,
+                  tlv::IncomingFaceId> IncomingFaceIdField;
 BOOST_CONCEPT_ASSERT((Field<IncomingFaceIdField>));
 
-typedef detail::FieldDecl<field_location_tags::Header,
-                          uint64_t,
-                          tlv::CongestionMark> CongestionMarkField;
+typedef FieldDecl<field_location_tags::Header,
+                  uint64_t,
+                  tlv::CongestionMark> CongestionMarkField;
 BOOST_CONCEPT_ASSERT((Field<CongestionMarkField>));
 
-typedef detail::FieldDecl<field_location_tags::Header,
-                          Sequence,
-                          tlv::Ack,
-                          true> AckField;
+typedef FieldDecl<field_location_tags::Header,
+                  Sequence,
+                  tlv::Ack,
+                  true> AckField;
 BOOST_CONCEPT_ASSERT((Field<AckField>));
 
-typedef detail::FieldDecl<field_location_tags::Header,
-                          Sequence,
-                          tlv::TxSequence> TxSequenceField;
+typedef FieldDecl<field_location_tags::Header,
+                  Sequence,
+                  tlv::TxSequence> TxSequenceField;
 BOOST_CONCEPT_ASSERT((Field<TxSequenceField>));
 
 /**
  * The value of the wire encoded field is the data between the provided iterators. During
  * encoding, the data is copied from the Buffer into the wire buffer.
  */
-typedef detail::FieldDecl<field_location_tags::Fragment,
-                          std::pair<Buffer::const_iterator, Buffer::const_iterator>,
-                          tlv::Fragment> FragmentField;
+typedef FieldDecl<field_location_tags::Fragment,
+                  std::pair<Buffer::const_iterator, Buffer::const_iterator>,
+                  tlv::Fragment> FragmentField;
 BOOST_CONCEPT_ASSERT((Field<FragmentField>));
 
 /**
diff --git a/src/lp/packet.cpp b/src/lp/packet.cpp
index c17f1bd..751faa6 100644
--- a/src/lp/packet.cpp
+++ b/src/lp/packet.cpp
@@ -20,7 +20,7 @@
  */
 
 #include "packet.hpp"
-#include "detail/field-info.hpp"
+#include "field-info.hpp"
 
 #include <boost/range/adaptor/reversed.hpp>
 
@@ -104,9 +104,9 @@
   wire.parse();
 
   bool isFirst = true;
-  detail::FieldInfo prev;
+  FieldInfo prev;
   for (const Block& element : wire.elements()) {
-    detail::FieldInfo info(element.type());
+    FieldInfo info(element.type());
 
     if (!info.isRecognized && !info.canIgnore) {
       BOOST_THROW_EXCEPTION(Error("unrecognized field " + to_string(element.type()) + " cannot be ignored"));
@@ -117,7 +117,7 @@
         BOOST_THROW_EXCEPTION(Error("non-repeatable field " + to_string(element.type()) + " cannot be repeated"));
       }
 
-      else if (info.tlvType != prev.tlvType && !detail::compareFieldSortOrder(prev, info)) {
+      else if (info.tlvType != prev.tlvType && !compareFieldSortOrder(prev, info)) {
         BOOST_THROW_EXCEPTION(Error("fields are not in correct sort order"));
       }
     }
@@ -132,9 +132,9 @@
 bool
 Packet::comparePos(uint64_t first, const Block& second)
 {
-  detail::FieldInfo firstInfo(first);
-  detail::FieldInfo secondInfo(second.type());
-  return detail::compareFieldSortOrder(firstInfo, secondInfo);
+  FieldInfo firstInfo(first);
+  FieldInfo secondInfo(second.type());
+  return compareFieldSortOrder(firstInfo, secondInfo);
 }
 
 } // namespace lp