Coverage for /Syzygy/core/string_table.h

CoverageLines executed / instrumented / missingexe / inst / missLanguageGroup
100.0%220.C++source

Line-by-line coverage:

   1    :  // Copyright 2013 Google Inc. All Rights Reserved.
   2    :  //
   3    :  // Licensed under the Apache License, Version 2.0 (the "License");
   4    :  // you may not use this file except in compliance with the License.
   5    :  // You may obtain a copy of the License at
   6    :  //
   7    :  //     http://www.apache.org/licenses/LICENSE-2.0
   8    :  //
   9    :  // Unless required by applicable law or agreed to in writing, software
  10    :  // distributed under the License is distributed on an "AS IS" BASIS,
  11    :  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12    :  // See the License for the specific language governing permissions and
  13    :  // limitations under the License.
  14    :  //
  15    :  // A StringTable is responsible of string allocation and string sharing.
  16    :  // Pointers to interned strings are valid until the destruction of the
  17    :  // StringTable.
  18    :  //
  19    :  // Example use is as follows:
  20    :  //
  21    :  // StringStable strtab;
  22    :  // const std::string& str1 = strtab.InternString("dummy");
  23    :  // const std::string& str2 = strtab.InternString("dummy");
  24    :  //
  25    :  // str1 and str2 are the same instance of a string holding the value "dummy".
  26    :  
  27    :  #ifndef SYZYGY_CORE_STRING_TABLE_H_
  28    :  #define SYZYGY_CORE_STRING_TABLE_H_
  29    :  
  30    :  #include <set>
  31    :  #include <string>
  32    :  
  33    :  #include "base/basictypes.h"
  34    :  #include "base/strings/string_piece.h"
  35    :  
  36    :  namespace core {
  37    :  
  38    :  class StringTable {
  39    :   public:
  40    :    // Default constructor.
  41  E :    StringTable() {
  42  E :    }
  43    :  
  44    :    // A pool of strings is maintained privately. If the pool already contains a
  45    :    // string equal to @p str, then the string from the pool is returned.
  46    :    // Otherwise, the string is added to the pool and a reference is returned.
  47    :    // @param str The string to internalized.
  48    :    // @returns a canonical representation for this string.
  49    :    const std::string& InternString(const base::StringPiece& str);
  50    :  
  51    :   protected:
  52    :    std::set<std::string> string_table_;
  53    :  
  54    :   private:
  55    :    DISALLOW_COPY_AND_ASSIGN(StringTable);
  56    :  };
  57    :  
  58    :  }  // namespace core
  59    :  
  60    :  #endif  // SYZYGY_CORE_STRING_TABLE_H_

Coverage information generated Thu Jan 14 17:40:38 2016.