1// Copyright 2012 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#include "polo/encoding/encodingoption.h" 16 17#include <sstream> 18 19namespace polo { 20namespace encoding { 21 22EncodingOption::EncodingOption(EncodingOption::EncodingType encoding_type, 23 uint32_t symbol_length) 24 : encoding_type_(encoding_type), 25 symbol_length_(symbol_length) { 26} 27 28EncodingOption::EncodingType EncodingOption::encoding_type() const { 29 return encoding_type_; 30} 31 32uint32_t EncodingOption::symbol_length() const { 33 return symbol_length_; 34} 35 36bool EncodingOption::Equals(const EncodingOption& other) const { 37 return encoding_type_ == other.encoding_type_ 38 && symbol_length_ == other.symbol_length_; 39} 40 41std::string EncodingOption::ToString() const { 42 std::ostringstream ss; 43 ss << encoding_type_ << ':' << symbol_length_; 44 return ss.str(); 45} 46 47} // namespace encoding 48} // namespace polo 49