diff options
author | Ruslan Kovalev <ruslan.a.kovalev@gmail.com> | 2022-02-10 16:46:44 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:46:44 +0300 |
commit | 59e19371de37995fcb36beb16cd6ec030af960bc (patch) | |
tree | fa68e36093ebff8b805462e9e6d331fe9d348214 /library/cpp/codecs/static/example | |
parent | 89db6fe2fe2c32d2a832ddfeb04e8d078e301084 (diff) | |
download | ydb-59e19371de37995fcb36beb16cd6ec030af960bc.tar.gz |
Restoring authorship annotation for Ruslan Kovalev <ruslan.a.kovalev@gmail.com>. Commit 1 of 2.
Diffstat (limited to 'library/cpp/codecs/static/example')
-rw-r--r-- | library/cpp/codecs/static/example/example.cpp | 76 | ||||
-rw-r--r-- | library/cpp/codecs/static/example/example.h | 24 | ||||
-rw-r--r-- | library/cpp/codecs/static/example/ya.make | 36 |
3 files changed, 68 insertions, 68 deletions
diff --git a/library/cpp/codecs/static/example/example.cpp b/library/cpp/codecs/static/example/example.cpp index 5b750b717e..0c50a1a5be 100644 --- a/library/cpp/codecs/static/example/example.cpp +++ b/library/cpp/codecs/static/example/example.cpp @@ -1,43 +1,43 @@ -#include "example.h" - +#include "example.h" + #include <library/cpp/codecs/static/static.h> - -#include <util/generic/yexception.h> - -extern "C" { + +#include <util/generic/yexception.h> + +extern "C" { extern const ui8 codec_info_huff_20160707[]; extern const ui32 codec_info_huff_20160707Size; extern const ui8 codec_info_sa_huff_20160707[]; extern const ui32 codec_info_sa_huff_20160707Size; -}; - -namespace NStaticCodecExample { - static const NCodecs::TCodecConstPtr CODECS[] = { - nullptr, - NCodecs::RestoreCodecFromArchive(codec_info_huff_20160707, codec_info_huff_20160707Size), - NCodecs::RestoreCodecFromArchive(codec_info_sa_huff_20160707, codec_info_sa_huff_20160707Size), - }; - - static_assert(Y_ARRAY_SIZE(CODECS) == DV_COUNT, "bad array size"); - - void Encode(TBuffer& out, TStringBuf in, EDictVersion dv) { - Y_ENSURE(dv > DV_NULL && dv < DV_COUNT, "invalid dict version: " << (int)dv); - out.Clear(); - if (!in) { - return; - } - CODECS[dv]->Encode(in, out); - out.Append((char)dv); - } - - void Decode(TBuffer& out, TStringBuf in) { - out.Clear(); - if (!in) { - return; - } - EDictVersion dv = (EDictVersion)in.back(); - Y_ENSURE(dv > DV_NULL && dv < DV_COUNT, "invalid dict version: " << (int)dv); - in.Chop(1); - CODECS[dv]->Decode(in, out); - } -} +}; + +namespace NStaticCodecExample { + static const NCodecs::TCodecConstPtr CODECS[] = { + nullptr, + NCodecs::RestoreCodecFromArchive(codec_info_huff_20160707, codec_info_huff_20160707Size), + NCodecs::RestoreCodecFromArchive(codec_info_sa_huff_20160707, codec_info_sa_huff_20160707Size), + }; + + static_assert(Y_ARRAY_SIZE(CODECS) == DV_COUNT, "bad array size"); + + void Encode(TBuffer& out, TStringBuf in, EDictVersion dv) { + Y_ENSURE(dv > DV_NULL && dv < DV_COUNT, "invalid dict version: " << (int)dv); + out.Clear(); + if (!in) { + return; + } + CODECS[dv]->Encode(in, out); + out.Append((char)dv); + } + + void Decode(TBuffer& out, TStringBuf in) { + out.Clear(); + if (!in) { + return; + } + EDictVersion dv = (EDictVersion)in.back(); + Y_ENSURE(dv > DV_NULL && dv < DV_COUNT, "invalid dict version: " << (int)dv); + in.Chop(1); + CODECS[dv]->Decode(in, out); + } +} diff --git a/library/cpp/codecs/static/example/example.h b/library/cpp/codecs/static/example/example.h index f9b3a7324b..070ca90f02 100644 --- a/library/cpp/codecs/static/example/example.h +++ b/library/cpp/codecs/static/example/example.h @@ -1,17 +1,17 @@ -#pragma once - -#include <util/generic/strbuf.h> -#include <util/generic/buffer.h> - -namespace NStaticCodecExample { +#pragma once + +#include <util/generic/strbuf.h> +#include <util/generic/buffer.h> + +namespace NStaticCodecExample { enum EDictVersion : ui8 { DV_NULL = 0, DV_HUFF_20160707, DV_SA_HUFF_20160707, DV_COUNT - }; - - void Encode(TBuffer&, TStringBuf, EDictVersion dv = DV_SA_HUFF_20160707); - - void Decode(TBuffer&, TStringBuf); -} + }; + + void Encode(TBuffer&, TStringBuf, EDictVersion dv = DV_SA_HUFF_20160707); + + void Decode(TBuffer&, TStringBuf); +} diff --git a/library/cpp/codecs/static/example/ya.make b/library/cpp/codecs/static/example/ya.make index ca6c5fd900..85dc222624 100644 --- a/library/cpp/codecs/static/example/ya.make +++ b/library/cpp/codecs/static/example/ya.make @@ -1,24 +1,24 @@ -LIBRARY() - -OWNER(velavokr) - -SRCS( - GLOBAL example.cpp -) - -PEERDIR( +LIBRARY() + +OWNER(velavokr) + +SRCS( + GLOBAL example.cpp +) + +PEERDIR( library/cpp/codecs library/cpp/codecs/static -) - -ARCHIVE_ASM( +) + +ARCHIVE_ASM( "solar-8k-a.huffman.1467494385.codec_info" NAME codec_info_sa_huff_20160707 -) - -ARCHIVE_ASM( +) + +ARCHIVE_ASM( "huffman.1467494385.codec_info" NAME codec_info_huff_20160707 -) - -END() +) + +END() |