wpkg test coverage results

Coverage test results of the Windows Packager by Made to Order Software Corporation.

LCOV - code coverage report
Current view: top level - controlled_vars - controlled_vars_ptr_auto_init.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 12 12 100.0 %
Date: 2013-06-17 Functions: 16 16 100.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // WARNING: do not edit; this is an auto-generated
       2             : // WARNING: file; please, use the generator named
       3             : // WARNING: controlled_vars to re-generate
       4             : //
       5             : // File:        controlled_vars_ptr_auto_init.h
       6             : // Object:      Help you by constraining basic types like classes.
       7             : //
       8             : // Copyright:   Copyright (c) 2005-2012 Made to Order Software Corp.
       9             : //              All Rights Reserved.
      10             : //
      11             : // http://snapwebsites.org/
      12             : // contact@m2osw.com
      13             : //
      14             : // Permission is hereby granted, free of charge, to any person obtaining a copy
      15             : // of this software and associated documentation files (the "Software"), to deal
      16             : // in the Software without restriction, including without limitation the rights
      17             : // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
      18             : // copies of the Software, and to permit persons to whom the Software is
      19             : // furnished to do so, subject to the following conditions:
      20             : //
      21             : // The above copyright notice and this permission notice shall be included in
      22             : // all copies or substantial portions of the Software.
      23             : //
      24             : // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
      25             : // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
      26             : // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
      27             : // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
      28             : // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
      29             : // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
      30             : // THE SOFTWARE.
      31             : //
      32             : #ifndef CONTROLLED_VARS_PTR_AUTO_INIT_H
      33             : #define CONTROLLED_VARS_PTR_AUTO_INIT_H
      34             : #ifdef _MSC_VER
      35             : #pragma warning(push)
      36             : #pragma warning(disable: 4005 4018 4244 4800)
      37             : #if _MSC_VER > 1000
      38             : #pragma once
      39             : #endif
      40             : #elif defined(__GNUC__)
      41             : #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) || (__GNUC__ >= 4)
      42             : #pragma once
      43             : #endif
      44             : #endif
      45             : #include "controlled_vars_exceptions.h"
      46             : namespace controlled_vars {
      47             : /** \brief Documentation available online.
      48             :  * Please go to http://snapwebsites.org/project/controlled-vars
      49             :  */
      50       30310 : template<class T> class trait_ptr_auto_null { public: static T *DEFAULT_VALUE() { return 0; } };
      51             : template<class T, typename init_value = trait_ptr_auto_null<T> > class ptr_auto_init {
      52             : public:
      53             :         typedef T *primary_type_t;
      54       29678 :         static T *DEFAULT_VALUE() { return init_value::DEFAULT_VALUE(); }
      55             :         static T *null() { return 0; }
      56       29678 :         ptr_auto_init() { f_ptr = DEFAULT_VALUE(); }
      57             :         ptr_auto_init(T *p) { f_ptr = p; }
      58             :         ptr_auto_init(T& p) { f_ptr = &p; }
      59             :         ptr_auto_init(const ptr_auto_init *p) { f_ptr = p == 0 ? 0 : p->f_ptr; }
      60             :         ptr_auto_init(const ptr_auto_init& p) { f_ptr = &p == 0 ? 0 : p.f_ptr; }
      61             :         operator primary_type_t () const { return f_ptr; }
      62        4588 :         operator primary_type_t () { return f_ptr; }
      63             :         primary_type_t value() const { return f_ptr; }
      64             :         T *get() const { return f_ptr; }
      65             :         primary_type_t *ptr() const { return &f_ptr; }
      66       69475 :         T *operator -> () const { if(f_ptr == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr; }
      67       15247 :         T& operator * () const { if(f_ptr == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return *f_ptr; }
      68             :         T operator [] (int index) const { if(f_ptr == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr[index]; }
      69             :         T *get() { return f_ptr; }
      70             :         primary_type_t *ptr() { return &f_ptr; }
      71        5220 :         T *operator -> () { if(f_ptr == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr; }
      72             :         T& operator * () { if(f_ptr == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return *f_ptr; }
      73             :         T& operator [] (int index) { if(f_ptr == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr[index]; }
      74             :         void swap(ptr_auto_init& p) { primary_type_t n(f_ptr); f_ptr = p.f_ptr; p.f_ptr = n; }
      75       69475 :         operator bool () const { return f_ptr != 0; }
      76       39929 :         bool operator ! () const { return f_ptr == 0; }
      77             :         ptr_auto_init& operator ++ () { ++f_ptr; return *this; }
      78             :         ptr_auto_init operator ++ (int) { ptr_auto_init<T> result(*this); ++f_ptr; return result; }
      79             :         ptr_auto_init& operator -- () { --f_ptr; return *this; }
      80             :         ptr_auto_init operator -- (int) { ptr_auto_init<T> result(*this); --f_ptr; return result; }
      81         632 :         void reset() { f_ptr = init_value::DEFAULT_VALUE(); }
      82             :         void reset(T& p) { f_ptr = &p; }
      83             :         void reset(primary_type_t p) { f_ptr = p; }
      84             :         void reset(const ptr_auto_init& p) { if(&p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); f_ptr = p.f_ptr; }
      85             :         void reset(const ptr_auto_init *p) { if(p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); f_ptr = p->f_ptr; }
      86             :         ptr_auto_init& operator = (T& p) { f_ptr = &p; return *this; }
      87        4588 :         ptr_auto_init& operator = (primary_type_t p) { f_ptr = p; return *this; }
      88             :         ptr_auto_init& operator = (const ptr_auto_init& p) { if(&p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); f_ptr = p.f_ptr; return *this; }
      89             :         ptr_auto_init& operator = (const ptr_auto_init *p) { if(p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); f_ptr = p->f_ptr; return *this; }
      90             :         primary_type_t operator += (signed char v) { return f_ptr += v; }
      91             :         primary_type_t operator += (unsigned char v) { return f_ptr += v; }
      92             : #if !defined(_MSC_VER) || (defined(_WCHAR_T_DEFINED) && defined(_NATIVE_WCHAR_T_DEFINED))
      93             :         primary_type_t operator += (wchar_t v) { return f_ptr += v; }
      94             : #endif
      95             :         primary_type_t operator += (int16_t v) { return f_ptr += v; }
      96             :         primary_type_t operator += (uint16_t v) { return f_ptr += v; }
      97             :         primary_type_t operator += (int32_t v) { return f_ptr += v; }
      98             :         primary_type_t operator += (uint32_t v) { return f_ptr += v; }
      99             : #if UINT_MAX == ULONG_MAX
     100             :         primary_type_t operator += (long v) { return f_ptr += v; }
     101             : #endif
     102             : #if UINT_MAX == ULONG_MAX
     103             :         primary_type_t operator += (unsigned long v) { return f_ptr += v; }
     104             : #endif
     105             :         primary_type_t operator += (int64_t v) { return f_ptr += v; }
     106             :         primary_type_t operator += (uint64_t v) { return f_ptr += v; }
     107             : //#ifdef __APPLE__
     108             : //      primary_type_t operator += (size_t v) { return f_ptr += v; }
     109             : //#endif
     110             :         primary_type_t operator -= (signed char v) { return f_ptr -= v; }
     111             :         primary_type_t operator -= (unsigned char v) { return f_ptr -= v; }
     112             : #if !defined(_MSC_VER) || (defined(_WCHAR_T_DEFINED) && defined(_NATIVE_WCHAR_T_DEFINED))
     113             :         primary_type_t operator -= (wchar_t v) { return f_ptr -= v; }
     114             : #endif
     115             :         primary_type_t operator -= (int16_t v) { return f_ptr -= v; }
     116             :         primary_type_t operator -= (uint16_t v) { return f_ptr -= v; }
     117             :         primary_type_t operator -= (int32_t v) { return f_ptr -= v; }
     118             :         primary_type_t operator -= (uint32_t v) { return f_ptr -= v; }
     119             : #if UINT_MAX == ULONG_MAX
     120             :         primary_type_t operator -= (long v) { return f_ptr -= v; }
     121             : #endif
     122             : #if UINT_MAX == ULONG_MAX
     123             :         primary_type_t operator -= (unsigned long v) { return f_ptr -= v; }
     124             : #endif
     125             :         primary_type_t operator -= (int64_t v) { return f_ptr -= v; }
     126             :         primary_type_t operator -= (uint64_t v) { return f_ptr -= v; }
     127             : //#ifdef __APPLE__
     128             : //      primary_type_t operator -= (size_t v) { return f_ptr -= v; }
     129             : //#endif
     130             :         primary_type_t operator + (signed char v) { return f_ptr + v; }
     131             :         primary_type_t operator + (unsigned char v) { return f_ptr + v; }
     132             : #if !defined(_MSC_VER) || (defined(_WCHAR_T_DEFINED) && defined(_NATIVE_WCHAR_T_DEFINED))
     133             :         primary_type_t operator + (wchar_t v) { return f_ptr + v; }
     134             : #endif
     135             :         primary_type_t operator + (int16_t v) { return f_ptr + v; }
     136             :         primary_type_t operator + (uint16_t v) { return f_ptr + v; }
     137             :         primary_type_t operator + (int32_t v) { return f_ptr + v; }
     138             :         primary_type_t operator + (uint32_t v) { return f_ptr + v; }
     139             : #if UINT_MAX == ULONG_MAX
     140             :         primary_type_t operator + (long v) { return f_ptr + v; }
     141             : #endif
     142             : #if UINT_MAX == ULONG_MAX
     143             :         primary_type_t operator + (unsigned long v) { return f_ptr + v; }
     144             : #endif
     145             :         primary_type_t operator + (int64_t v) { return f_ptr + v; }
     146             :         primary_type_t operator + (uint64_t v) { return f_ptr + v; }
     147             : //#ifdef __APPLE__
     148             : //      primary_type_t operator + (size_t v) { return f_ptr + v; }
     149             : //#endif
     150             :         primary_type_t operator - (signed char v) { return f_ptr - v; }
     151             :         primary_type_t operator - (unsigned char v) { return f_ptr - v; }
     152             : #if !defined(_MSC_VER) || (defined(_WCHAR_T_DEFINED) && defined(_NATIVE_WCHAR_T_DEFINED))
     153             :         primary_type_t operator - (wchar_t v) { return f_ptr - v; }
     154             : #endif
     155             :         primary_type_t operator - (int16_t v) { return f_ptr - v; }
     156             :         primary_type_t operator - (uint16_t v) { return f_ptr - v; }
     157             :         primary_type_t operator - (int32_t v) { return f_ptr - v; }
     158             :         primary_type_t operator - (uint32_t v) { return f_ptr - v; }
     159             : #if UINT_MAX == ULONG_MAX
     160             :         primary_type_t operator - (long v) { return f_ptr - v; }
     161             : #endif
     162             : #if UINT_MAX == ULONG_MAX
     163             :         primary_type_t operator - (unsigned long v) { return f_ptr - v; }
     164             : #endif
     165             :         primary_type_t operator - (int64_t v) { return f_ptr - v; }
     166             :         primary_type_t operator - (uint64_t v) { return f_ptr - v; }
     167             : //#ifdef __APPLE__
     168             : //      primary_type_t operator - (size_t v) { return f_ptr - v; }
     169             : //#endif
     170             :         bool operator == (T& p) { return f_ptr == &p; }
     171             :         bool operator == (primary_type_t p) { return f_ptr == p; }
     172             :         bool operator == (const ptr_auto_init& p) { if(&p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr == p.f_ptr; }
     173             :         bool operator == (const ptr_auto_init *p) { if(p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr == p->f_ptr; }
     174             :         bool operator != (T& p) { return f_ptr != &p; }
     175        4588 :         bool operator != (primary_type_t p) { return f_ptr != p; }
     176             :         bool operator != (const ptr_auto_init& p) { if(&p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr != p.f_ptr; }
     177             :         bool operator != (const ptr_auto_init *p) { if(p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr != p->f_ptr; }
     178             :         bool operator < (T& p) { return f_ptr < &p; }
     179             :         bool operator < (primary_type_t p) { return f_ptr < p; }
     180             :         bool operator < (const ptr_auto_init& p) { if(&p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr < p.f_ptr; }
     181             :         bool operator < (const ptr_auto_init *p) { if(p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr < p->f_ptr; }
     182             :         bool operator <= (T& p) { return f_ptr <= &p; }
     183             :         bool operator <= (primary_type_t p) { return f_ptr <= p; }
     184             :         bool operator <= (const ptr_auto_init& p) { if(&p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr <= p.f_ptr; }
     185             :         bool operator <= (const ptr_auto_init *p) { if(p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr <= p->f_ptr; }
     186             :         bool operator > (T& p) { return f_ptr > &p; }
     187             :         bool operator > (primary_type_t p) { return f_ptr > p; }
     188             :         bool operator > (const ptr_auto_init& p) { if(&p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr > p.f_ptr; }
     189             :         bool operator > (const ptr_auto_init *p) { if(p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr > p->f_ptr; }
     190             :         bool operator >= (T& p) { return f_ptr >= &p; }
     191             :         bool operator >= (primary_type_t p) { return f_ptr >= p; }
     192             :         bool operator >= (const ptr_auto_init& p) { if(&p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr >= p.f_ptr; }
     193             :         bool operator >= (const ptr_auto_init *p) { if(p == 0) throw controlled_vars_error_null_pointer("dereferencing a null pointer"); return f_ptr >= p->f_ptr; }
     194             : #ifdef CONTROLLED_VARS_DEBUG
     195             :         bool is_initialized() const { return true; }
     196             : #endif
     197             : private:
     198             :         primary_type_t f_ptr;
     199             : };
     200             : typedef ptr_auto_init<bool> zpbool_t;
     201             : typedef ptr_auto_init<char> zpchar_t;
     202             : typedef ptr_auto_init<signed char> zpschar_t;
     203             : typedef ptr_auto_init<unsigned char> zpuchar_t;
     204             : #if !defined(_MSC_VER) || (defined(_WCHAR_T_DEFINED) && defined(_NATIVE_WCHAR_T_DEFINED))
     205             : typedef ptr_auto_init<wchar_t> zpwchar_t;
     206             : #endif
     207             : typedef ptr_auto_init<int16_t> zpint16_t;
     208             : typedef ptr_auto_init<uint16_t> zpuint16_t;
     209             : typedef ptr_auto_init<int32_t> zpint32_t;
     210             : typedef ptr_auto_init<uint32_t> zpuint32_t;
     211             : #if UINT_MAX == ULONG_MAX
     212             : typedef ptr_auto_init<long> zpplain_long_t;
     213             : #endif
     214             : #if UINT_MAX == ULONG_MAX
     215             : typedef ptr_auto_init<unsigned long> zpplain_ulong_t;
     216             : #endif
     217             : typedef ptr_auto_init<int64_t> zpint64_t;
     218             : typedef ptr_auto_init<uint64_t> zpuint64_t;
     219             : //#ifdef __APPLE__
     220             : //typedef ptr_auto_init<size_t> zpsize_t;
     221             : //#endif
     222             : //#ifdef __APPLE__
     223             : //typedef ptr_auto_init<time_t> zptime_t;
     224             : //#endif
     225             : } // namespace controlled_vars
     226             : #ifdef _MSC_VER
     227             : #pragma warning(pop)
     228             : #endif
     229             : #endif

Generated by: LCOV version 1.9

The wpkg tool is an open source tool created by Made to Order Software Corporation.