/usr/include/dclib-0.3/dclib/core/ciconv.h is in libdc-dev 0.3.24~svn3121-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 | /***************************************************************************
ciconv.h - DCLib C++ iconv wrapper
-------------------
begin : Thu Sep 20 2007
copyright : (C) 2007 by Edward Sheldrake
email : ejs1920@yahoo.co.uk
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef CICONV_H
#define CICONV_H
/**
* @author Edward Sheldrake
*
* It converts between encodings.
*
* The input is a CString and the output is another CString, really
* it would have been better for a CString to be in some defined
* encoding.
*/
#include <dclib/dcos.h>
#include <dclib/core/cstring.h>
#include <iconv.h>
#include <string.h>
class CIconv {
public:
/**
* Constructor using specified encodings.
* Note that from and to are the other way around
* compared to the iconv_open.
*/
CIconv( const CString & from, const CString & to );
/** Destructor */
~CIconv();
/** Encode text between the encodings. */
CString encode( const CString & text );
/**
* Encode text between the encodings.
* This one is slower than the first, since it needs to call strlen,
* but faster than creating a CString since there's no copying of the input.
*/
CString encode( const char * data );
private:
/** iconv structure used for encoding */
iconv_t cd;
/** facility to disable encoding */
bool disabled;
/**
* Does the actual encoding.
*/
CString encode( const char * data, const size_t len );
};
/** inline functions */
/** */
inline CString CIconv::encode( const CString & text )
{
if ( disabled )
{
return text;
}
else
{
return encode( text.Data(), text.Length() );
}
}
/** */
inline CString CIconv::encode( const char * data )
{
if ( disabled )
{
return CString(data);
}
else
{
return encode( data, strlen(data) );
}
}
#endif // CICONV_H
|