Web Wispers 1.2.2 C++ Unit Test Coverage
Current view: top level - ssrc/wispers/utility - uuid_key.cc (source / functions) Hit Total Coverage
Test: Web Wispers 1.2.2 C++ Unit Tests Lines: 4 4 100.0 %
Date: 2012-04-09 Functions: 3 3 100.0 %
Branches: 2 4 50.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright 2010 Savarese Software Research Corporation
       3                 :            :  *
       4                 :            :  * Licensed under the Apache License, Version 2.0 (the "License");
       5                 :            :  * you may not use this file except in compliance with the License.
       6                 :            :  * You may obtain a copy of the License at
       7                 :            :  *
       8                 :            :  *     https://www.savarese.com/software/ApacheLicense-2.0
       9                 :            :  *
      10                 :            :  * Unless required by applicable law or agreed to in writing, software
      11                 :            :  * distributed under the License is distributed on an "AS IS" BASIS,
      12                 :            :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13                 :            :  * See the License for the specific language governing permissions and
      14                 :            :  * limitations under the License.
      15                 :            :  */
      16                 :            : 
      17                 :            : #include <ssrc/wispers/utility/uuid_key.h>
      18                 :            : //#include <ssrc/wispers/utility/UUIDGenerator.h>
      19                 :            : 
      20                 :            : #include <ostream>
      21                 :            : #include <cstdio>
      22                 :            : 
      23                 :            : __BEGIN_NS_SSRC_WSPR
      24                 :            : 
      25                 :        100 : std::ostream & operator<<(std::ostream & out, const uuid_key_type & uuid_key) {
      26                 :            :   // We do it this way because the commented out section isn't zero-padding
      27                 :            :   // the low bits.
      28                 :            :   char buf[65];
      29                 :            :   ::snprintf(buf, sizeof(buf), "%0.16llx%0.16llx",
      30                 :        100 :              uuid_key.high_bits, uuid_key.low_bits);
      31                 :        100 :   return (out << buf);
      32                 :            :   /*
      33                 :            :   std::ostream::fmtflags flags = out.flags();
      34                 :            :   std::streamsize width = out.width(boost::uuids::uuid::static_size());
      35                 :            :   std::ostream::char_type fill = out.fill('0');
      36                 :            : 
      37                 :            :   out.setf(std::ios::hex, std::ios::basefield);
      38                 :            :   out.setf(std::ios::right, std::ios::adjustfield);
      39                 :            : 
      40                 :            :   out << uuid_key.high_bits << uuid_key.low_bits;
      41                 :            : 
      42                 :            :   out.fill(fill);
      43                 :            :   out.width(width);
      44                 :            :   out.flags(flags);
      45                 :            :   return out;
      46                 :            :   */
      47                 :            : }
      48                 :            : 
      49   [ +  -  +  - ]:          3 : __END_NS_SSRC_WSPR