cache_codec.h
Go to the documentation of this file.
/*
* Copyright (C) 2015 Canonical Ltd.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* Authored by: Michi Henning <michi.henning@canonical.com>
*/
#pragma once
#include <string>
namespace core
{
template <typename T>
struct CacheCodec
{
static std::string encode(T const& value);
static T decode(std::string const& s);
};
} // namespace core
core::CacheCodec
Definition: cache_codec.h:38
core
Top-level namespace for core functionality.
Definition: persistent_cache_stats.h:27
core::CacheCodec::encode
static std::string encode(T const &value)
Converts a value of custom type T into a string.
core::CacheCodec::decode
static T decode(std::string const &s)
Converts a string into a value of custom type T.