javacommons/utils/inc/javacommonutils.h
branchRCL_3
changeset 60 6c158198356e
parent 19 04becd199f91
child 83 26b2b12093af
--- a/javacommons/utils/inc/javacommonutils.h	Thu Jul 15 18:31:06 2010 +0300
+++ b/javacommons/utils/inc/javacommonutils.h	Thu Aug 19 09:48:13 2010 +0300
@@ -87,6 +87,23 @@
     OS_IMPORT static std::string base64encode(const std::string& aData);
 
     /**
+     * Encode wstring to base64 wstring byte by byte.
+     *
+     * wstring aData is base64 encoded as a byte array.
+     * If the wstring has been created from TDesC16 in Symbian it contains
+     * UTF-16LE (UCS-2) encoded 16-bit characters.
+     * The result is byte array that contains 8-bit ASCII characters.
+     * Each of these 8-bit character is converted to the corresponding
+     * wchar and appended to the result wstring.
+     *
+     * @see \sf\app\jrt\javamanager\javainstaller\installer\javasrc\com\nokia
+     *  \mj\impl\installer\utils\Args.java, decodeBase64Args()
+     * @param aData wstring containing the data to be encoded.
+     * @return base64 encoded result wstring.
+     */
+    OS_IMPORT static std::wstring wbase64encode(const std::wstring& aData);
+
+    /**
      * Decode base64 string.
      *
      * @param aData base64 encoded string.
@@ -105,6 +122,33 @@
      */
     OS_IMPORT static std::wstring percentDecode(const std::wstring& str);
 
+    /**
+     * This function checks whether is it called during the first device boot
+     * and stores the information to static data so that isFirstBoot() can
+     * return it.
+     *
+     * Call this function always when the process is starting.
+     *
+     * This function creates a flag file to the private data cage / work directory
+     * of the process.
+     *
+     * In Symbian this method can be called only from Java Installer or
+     * Java MIDP processes.
+     *
+     * Return 0 if check was made successfully. Otherwise it returns errno
+     * defined in STDLIBS errno.h
+     */
+    OS_IMPORT static int initIsFirstBoot();
+
+    /**
+     * This function returns true if it called during the first boot.
+     * Otherwise it returns false.
+     *
+     * initIsFirstBoot() must be called before this function can be called.
+     */
+    OS_IMPORT static bool isFirstBoot();
+
+
 public:
     /**
      * Decodes one %<X><Y> sequence.
@@ -114,6 +158,10 @@
      * @throws ExceptionBase if <X> and <Y> are not hexadecimal characters
      */
     static char decodeOnePercentSeq(wchar_t first, wchar_t sec);
+
+private:
+    static bool mFirstBoot;
+
 };
 
 // A simple class for storing char array that is deleted automatically