revised base64.h;bitmap.h

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52553 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Francesco Montorsi
2008-03-15 18:15:46 +00:00
parent 390f44afb6
commit 698d17c32c
3 changed files with 460 additions and 436 deletions

View File

@@ -6,38 +6,69 @@
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// ============================================================================
// Global functions/macros
// ============================================================================
/** @ingroup group_funcmacro_misc */
//@{ //@{
/** /**
These functions encode the given data using base64. The first of them is the This function encodes the given data using base64.
raw encoding function writing the output string into provided buffer while the
other ones return the output as wxString. There is no error return for these To allocate the buffer of the correct size, use wxBase64EncodedSize() or call
functions except for the first one which returns @c wxCONV_FAILED if the this function with @a dst set to @NULL -- it will then return the necessary
output buffer is too small. To allocate the buffer of the correct size, use buffer size.
wxBase64EncodedSize() or call this function with
@a dst set to @NULL -- it will then return the necessary buffer size. This raw encoding function overload writes the output string into the
provided buffer; the other overloads return it as a wxString.
@param dst @param dst
The output buffer, may be @NULL to retrieve the needed buffer The output buffer, may be @NULL to retrieve the needed buffer size.
size.
@param dstLen @param dstLen
The output buffer size, ignored if dst is @NULL. The output buffer size, ignored if dst is @NULL.
@param src @param src
The input buffer, must not be @NULL. The input buffer, must not be @NULL.
@param srcLen @param srcLen
The length of the input data. The length of the input data.
@returns @c wxCONV_FAILED if the output buffer is too small.
*/ */
size_t wxBase64Encode(char* dst, size_t dstLen, size_t wxBase64Encode(char* dst, size_t dstLen,
const void* src, const void* src,
size_t srcLen); size_t srcLen);
/**
This function encodes the given data using base64 and returns the output
as a wxString.
There is no error return.
To allocate the buffer of the correct size, use wxBase64EncodedSize() or call
this function with @a dst set to @NULL -- it will then return the necessary
buffer size.
@param src
The input buffer, must not be @NULL.
@param srcLen
The length of the input data.
*/
wxString wxBase64Encode(const void* src, size_t srcLen); wxString wxBase64Encode(const void* src, size_t srcLen);
/**
This function encodes the given data using base64 and returns the output
as a wxString.
There is no error return.
*/
wxString wxBase64Encode(const wxMemoryBuffer& buf); wxString wxBase64Encode(const wxMemoryBuffer& buf);
//@}
/** /**
Returns the size of the buffer necessary to contain the data encoded in a Returns the size of the buffer necessary to contain the data encoded in a
base64 string of length @e srcLen. This can be useful for allocating a base64 string of length @e srcLen. This can be useful for allocating a
buffer to be passed to wxBase64Decode(). buffer to be passed to wxBase64Decode().
*/ */
size_t wxBase64DecodedSize(size_t srcLen); size_t wxBase64DecodedSize(size_t srcLen);
@@ -48,41 +79,34 @@ size_t wxBase64DecodedSize(size_t srcLen);
*/ */
size_t wxBase64EncodedSize(size_t len); size_t wxBase64EncodedSize(size_t len);
//@{
/** /**
These function decode a Base64-encoded string. The first version is a raw This function decodes a Base64-encoded string.
decoding function and decodes the data into the provided buffer @a dst of
the given size @e dstLen. An error is returned if the buffer is not large This overload is a raw decoding function and decodes the data into the provided
enough -- that is not at least wxBase64DecodedSize(srcLen)() buffer @a dst of the given size @e dstLen. An error is returned if the buffer
bytes. The second version allocates memory internally and returns it as is not large enough -- that is not at least wxBase64DecodedSize(srcLen)() bytes.
wxMemoryBuffer and is recommended for normal use.
The first version returns the number of bytes written to the buffer or the This overload returns the number of bytes written to the buffer or the
necessary buffer size if @a dst was @NULL or @c wxCONV_FAILED on necessary buffer size if @a dst was @NULL or @c wxCONV_FAILED on
error, e.g. if the output buffer is too small or invalid characters were error, e.g. if the output buffer is too small or invalid characters were
encountered in the input string. The second version returns a buffer with the encountered in the input string.
base64 decoded binary equivalent of the input string. In neither case is the
buffer NUL-terminated.
@param dst @param dst
Pointer to output buffer, may be @NULL to just compute the Pointer to output buffer, may be @NULL to just compute the
necessary buffer size. necessary buffer size.
@param dstLen @param dstLen
The size of the output buffer, ignored if dst is The size of the output buffer, ignored if dst is @NULL.
@NULL.
@param src @param src
The input string, must not be @NULL. For the version using The input string, must not be @NULL. For the version using
wxString, the input string should contain only ASCII characters. wxString, the input string should contain only ASCII characters.
@param srcLen @param srcLen
The length of the input string or special value The length of the input string or special value wxNO_LEN if the string is
wxNO_LEN if the string is NUL-terminated and the length should be NUL-terminated and the length should be computed by this function itself.
computed by this function itself.
@param mode @param mode
This parameter specifies the function behaviour when invalid This parameter specifies the function behaviour when invalid characters
characters are encountered in input. By default, any such character stops are encountered in input. By default, any such character stops the
the
decoding with error. If the mode is wxBase64DecodeMode_SkipWS, then the decoding with error. If the mode is wxBase64DecodeMode_SkipWS, then the
white white space characters are silently skipped instead. And if it is
space characters are silently skipped instead. And if it is
wxBase64DecodeMode_Relaxed, then all invalid characters are skipped. wxBase64DecodeMode_Relaxed, then all invalid characters are skipped.
@param posErr @param posErr
If this pointer is non-@NULL and an error occurs during If this pointer is non-@NULL and an error occurs during
@@ -93,12 +117,32 @@ size_t wxBase64Decode(void* dst, size_t dstLen,
size_t srcLen = wxNO_LEN, size_t srcLen = wxNO_LEN,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t posErr = NULL); size_t posErr = NULL);
/**
See the wxBase64Decode(void*,size_t,const char*,size_t,wxBase64DecodeMode,size_t)
overload for more info about the parameters of this function.
This overload allocates memory internally and returns it as wxMemoryBuffer
and is recommended for normal use.
This overload returns a buffer with the base64 decoded binary equivalent
of the input string. In neither case is the buffer @NULL-terminated.
*/
wxMemoryBuffer wxBase64Decode(const char* src, wxMemoryBuffer wxBase64Decode(const char* src,
size_t srcLen = wxNO_LEN, size_t srcLen = wxNO_LEN,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t posErr = NULL); size_t posErr = NULL);
/**
See the wxBase64Decode(void*,size_t,const char*,size_t,wxBase64DecodeMode,size_t)
overload for more info about the parameters of this function.
This overload takes as input a wxString and returns the internally-allocated
memory as a wxMemoryBuffer, containing the base64 decoded data.
*/
wxMemoryBuffer wxBase64Decode(const wxString& src, wxMemoryBuffer wxBase64Decode(const wxString& src,
wxBase64DecodeMode mode = wxBase64DecodeMode_Strict, wxBase64DecodeMode mode = wxBase64DecodeMode_Strict,
size_t posErr = NULL); size_t posErr = NULL);
//@} //@}

File diff suppressed because it is too large Load Diff

View File

@@ -6,6 +6,93 @@
// Licence: wxWindows license // Licence: wxWindows license
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
/**
Bitmap flags.
*/
enum wxBitmapType
{
wxBITMAP_TYPE_INVALID,
wxBITMAP_TYPE_BMP,
wxBITMAP_TYPE_BMP_RESOURCE,
wxBITMAP_TYPE_RESOURCE = wxBITMAP_TYPE_BMP_RESOURCE,
wxBITMAP_TYPE_ICO,
wxBITMAP_TYPE_ICO_RESOURCE,
wxBITMAP_TYPE_CUR,
wxBITMAP_TYPE_CUR_RESOURCE,
wxBITMAP_TYPE_XBM,
wxBITMAP_TYPE_XBM_DATA,
wxBITMAP_TYPE_XPM,
wxBITMAP_TYPE_XPM_DATA,
wxBITMAP_TYPE_TIF,
wxBITMAP_TYPE_TIF_RESOURCE,
wxBITMAP_TYPE_GIF,
wxBITMAP_TYPE_GIF_RESOURCE,
wxBITMAP_TYPE_PNG,
wxBITMAP_TYPE_PNG_RESOURCE,
wxBITMAP_TYPE_JPEG,
wxBITMAP_TYPE_JPEG_RESOURCE,
wxBITMAP_TYPE_PNM,
wxBITMAP_TYPE_PNM_RESOURCE,
wxBITMAP_TYPE_PCX,
wxBITMAP_TYPE_PCX_RESOURCE,
wxBITMAP_TYPE_PICT,
wxBITMAP_TYPE_PICT_RESOURCE,
wxBITMAP_TYPE_ICON,
wxBITMAP_TYPE_ICON_RESOURCE,
wxBITMAP_TYPE_ANI,
wxBITMAP_TYPE_IFF,
wxBITMAP_TYPE_TGA,
wxBITMAP_TYPE_MACCURSOR,
wxBITMAP_TYPE_MACCURSOR_RESOURCE,
wxBITMAP_TYPE_ANY = 50
};
/**
Standard cursors.
*/
enum wxStockCursor
{
wxCURSOR_NONE,
wxCURSOR_ARROW,
wxCURSOR_RIGHT_ARROW,
wxCURSOR_BULLSEYE,
wxCURSOR_CHAR,
wxCURSOR_CROSS,
wxCURSOR_HAND,
wxCURSOR_IBEAM,
wxCURSOR_LEFT_BUTTON,
wxCURSOR_MAGNIFIER,
wxCURSOR_MIDDLE_BUTTON,
wxCURSOR_NO_ENTRY,
wxCURSOR_PAINT_BRUSH,
wxCURSOR_PENCIL,
wxCURSOR_POINT_LEFT,
wxCURSOR_POINT_RIGHT,
wxCURSOR_QUESTION_ARROW,
wxCURSOR_RIGHT_BUTTON,
wxCURSOR_SIZENESW,
wxCURSOR_SIZENS,
wxCURSOR_SIZENWSE,
wxCURSOR_SIZEWE,
wxCURSOR_SIZING,
wxCURSOR_SPRAYCAN,
wxCURSOR_WAIT,
wxCURSOR_WATCH,
wxCURSOR_BLANK,
wxCURSOR_DEFAULT, //!< standard X11 cursor
wxCURSOR_COPY_ARROW , //!< MacOS Theme Plus arrow
// Not yet implemented for Windows
wxCURSOR_CROSS_REVERSE,
wxCURSOR_DOUBLE_ARROW,
wxCURSOR_BASED_ARROW_UP,
wxCURSOR_BASED_ARROW_DOWN,
wxCURSOR_ARROWWAIT,
wxCURSOR_MAX
};
/** /**
@class wxRealPoint @class wxRealPoint
@wxheader{gdicmn.h} @wxheader{gdicmn.h}