AndroMeta  2.0.0
AndroMeta/include/AndroMeta/MEncoder.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2009-2012 AndroMeta LLC. All rights reserved.
00003  *
00004  * AndroMeta LLC retains all intellectual property and proprietary 
00005  * rights to this software and related documentation and any modifications 
00006  * thereto.  Any use, reproduction, disclosure, or distribution of this 
00007  * software and related documentation without an express license agreement 
00008  * from AndroMeta LLC is strictly prohibited.
00009  * 
00010  */
00011 
00019 #ifndef ANDROMETA_M_ENCODER_H
00020 #define ANDROMETA_M_ENCODER_H
00021 
00022 #include <AndroMeta/MVar.h>
00023 
00024 namespace Meta{
00025   
00034   class MEncoder{
00035   public:
00036     
00051     static bool open(const mstr& path, mvar& out, bool config=false);
00052     
00069     static bool save(const mstr& path,
00070                      const mvar& in,
00071                      bool config=false,
00072                      const mstr& tempPath="");
00073     
00085     static char* pack(const mvar& in, size_t& length);
00086     
00107     static char* pack(const mvar& in,
00108                       char* buffer,
00109                       size_t& size,
00110                       size_t& pos,
00111                       bool resize=false);
00112     
00120     static void unpack(mvar& out, char* buffer);
00121     
00132     static void unpack(mvar& out, char* buffer, size_t& pos);
00133     
00149     static void compress(char* in,
00150                          size_t inSize,
00151                          char* out,
00152                          size_t& outSize);
00153     
00167     static char* compress(char* in, size_t inSize, size_t& outSize);
00168     
00189     static char* decompress(char* in,
00190                             size_t inSize,
00191                             char* out,
00192                             size_t& outSize,
00193                             bool resize);
00194     
00210     static char* decompress(char* in, size_t inSize, size_t& outSize);
00211     
00219     static void encode(const mvar& in, mvar& out);
00220     
00228     static void decode(const mvar& in, mvar& out);
00229     
00238     static mstr checksum(const char* buffer);
00239     
00246     static mstr generateKey(const mstr& user, const mstr& password);
00247   };
00248   
00249 } // end namespace Meta
00250 
00251 #endif // ANDROMETA_M_ENCODER_H