fka mod

Fork of BLE_API by Bluetooth Low Energy

Revision:
1179:4ab722f8dca0
Parent:
1156:e1ea38b576c6
Child:
1183:1589830dbdb7
--- a/ble/SafeBool.h	Wed Apr 06 19:15:28 2016 +0100
+++ b/ble/SafeBool.h	Wed Apr 06 19:15:30 2016 +0100
@@ -17,32 +17,26 @@
 #ifndef BLE_API_SAFE_BOOL_H_
 #define BLE_API_SAFE_BOOL_H_
 
-/* Safe bool idiom, see : http://www.artima.com/cppsource/safebool.html */
+//safe bool idiom, see : http://www.artima.com/cppsource/safebool.html
 
 namespace SafeBool_ {
 /**
- * @brief Base class for all intances of SafeBool.
- * This base class reduces instantiation of trueTag function.
+ * @brief Base class for all intances of SafeBool, 
+ * This base class reduce instantiation of trueTag function
  */
 class base {
   template<typename>
   friend class SafeBool;
 
 protected:
-    /**
-     * The bool type is a pointer to method which can be used in boolean context.
-     */
-    typedef void (base::*BoolType_t)() const;
+    //the bool type is a pointer to method which can be used in boolean context
+  typedef void (base::*BoolType_t)() const;
 
-    /**
-     * Non implemented call, use to disallow conversion between unrelated types.
-     */
-    void invalidTag() const;
+  // non implemented call, use to disallow conversion between unrelated types 
+  void invalidTag() const;
 
-    /**
-     * Member function which indicate true value.
-     */
-    void trueTag() const {}
+  // member function which indicate true value
+  void trueTag() const {}
 };
 
 
@@ -50,75 +44,71 @@
 
 /**
  * @brief template class SafeBool use CRTP to made boolean conversion easy and correct.
- * Derived class should implement the function bool toBool() const to make this work. Inheritance
+ * Derived class should implement the function bool toBool() const to make this work. Inheritance 
  * should be public.
  *
  * @tparam T Type of the derived class
- *
- * @code
- *
- * class A : public SafeBool<A> {
+ * 
+ * \code 
+ * 
+ * class A : public SafeBool<A> { 
  * public:
- *
+ * 
  *      // boolean conversion
- *      bool toBool() {
- *
- *      }
+ *      bool toBool() { 
+ *      
+ *      }  
  * };
- *
- * class B : public SafeBool<B> {
+ * 
+ * class B : public SafeBool<B> { 
  * public:
- *
+ * 
  *      // boolean conversion
- *      bool toBool() const {
- *
- *      }
+ *      bool toBool() const { 
+ *      
+ *      }  
  * };
- *
+ * 
  * A a;
  * B b;
- *
- * // will compile
- * if(a) {
- *
+ * 
+ * // will compile 
+ * if(a) { 
+ * 
  * }
- *
- * // compilation error
- * if(a == b) {
- *
+ * 
+ * // compilation error 
+ * if(a == b) { 
+ * 
  * }
- *
- *
- * @endcode
+ * 
+ * 
+ * \endcode
  */
-template <typename T>
+template <typename T> 
 class SafeBool : public SafeBool_::base {
 public:
-    /**
-     * Bool operator implementation, derived class has to provide bool toBool() const function.
-     */
-    operator BoolType_t() const {
-        return (static_cast<const T*>(this))->toBool()
-            ? &SafeBool<T>::trueTag : 0;
-    }
+  /** 
+   * bool operator implementation, derived class has to provide bool toBool() const function.
+   */
+  operator BoolType_t() const {
+    return (static_cast<const T*>(this))->toBool()
+      ? &SafeBool<T>::trueTag : 0;
+  }
 };
 
-/**
- * Avoid conversion to bool between different classes.
- */
+//Avoid conversion to bool between different classes
 template <typename T, typename U>
 void operator==(const SafeBool<T>& lhs,const SafeBool<U>& rhs) {
     lhs.invalidTag();
-    // return false;
+//    return false;
 }
 
-/**
- * Avoid conversion to bool between different classes.
- */
+//Avoid conversion to bool between different classes
 template <typename T,typename U>
 void operator!=(const SafeBool<T>& lhs,const SafeBool<U>& rhs) {
-    lhs.invalidTag();
-    // return false;
+  lhs.invalidTag();
+//  return false;
 }
 
 #endif /* BLE_API_SAFE_BOOL_H_ */
\ No newline at end of file