X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fgdu.cpp;h=1d4b7b2859edcc977217ee7d3faf14e2d6c121f2;hb=bed85d2160500f57db63f4ab9d5533e0225cce15;hp=987f4b9e51e0470ee0435192d383f5aa5ecb1791;hpb=9fef1c618f2f936041b3b58d61e406182033ab30;p=yazpp-moved-to-github.git diff --git a/src/gdu.cpp b/src/gdu.cpp index 987f4b9..1d4b7b2 100644 --- a/src/gdu.cpp +++ b/src/gdu.cpp @@ -1,8 +1,11 @@ /* This file is part of the yazpp toolkit. - * Copyright (C) 1998-2009 Index Data and Mike Taylor + * Copyright (C) 1998-2012 Index Data and Mike Taylor * See the file LICENSE for details. */ +#if HAVE_CONFIG_H +#include +#endif #include using namespace yazpp_1; @@ -46,6 +49,15 @@ void GDU::base(Z_GDU *gdu, ODR encode) odr_destroy(encode); } +int GDU::get_size() +{ + int len = 0; + ODR encode = odr_createmem(ODR_ENCODE); + if (m_gdu && z_GDU(encode, &m_gdu, 0, "encode")) + odr_getbuf(encode, &len, 0); + odr_destroy(encode); + return len; +} GDU &GDU::operator=(const GDU &g) { @@ -82,6 +94,7 @@ void GDU::move_away_gdu(ODR dst, Z_GDU **gdu) /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab