Home | History | Annotate | Download | only in include
      1 /* ------------------------------------------------------------------
      2  * Copyright (C) 1998-2009 PacketVideo
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
     13  * express or implied.
     14  * See the License for the specific language governing permissions
     15  * and limitations under the License.
     16  * -------------------------------------------------------------------
     17  */
     18 #ifndef PVMI_KVP_UTIL_H_INCLUDED
     19 #define PVMI_KVP_UTIL_H_INCLUDED
     20 
     21 #ifndef OSCL_BASE_H_INCLUDED
     22 #include "oscl_base.h"
     23 #endif
     24 
     25 #ifndef OSCL_STRING_CONTAINERS_H_INCLUDED
     26 #include "oscl_string_containers.h"
     27 #endif
     28 
     29 #ifndef OSCL_MEM_H_INCLUDED
     30 #include "oscl_mem.h"
     31 #endif
     32 
     33 #ifndef PVMI_KVP_H_INCLUDED
     34 #include "pvmi_kvp.h"
     35 #endif
     36 
     37 #ifndef PVMF_RETURN_CODES_H_INCLUDED
     38 #include "pvmf_return_codes.h"
     39 #endif
     40 
     41 /**
     42  * This function returns the type parameter ("type=") index for the input key string
     43  *
     44  * @param aKeyString      The input key string to determine the type parameter
     45  * @returns               One of PvmiKvpType enum. If the type cannot be determined PVMI_KVPTYPE_UNKNOWN will be returned
     46  */
     47 OSCL_IMPORT_REF PvmiKvpType GetTypeFromKeyString(PvmiKeyType aKeyString);
     48 
     49 /**
     50  * This function returns the attribute parameter ("attr=") index for the input key string
     51  *
     52  * @param aKeyString      The input key string to determine the attribute parameter
     53  * @returns               One of PvmiKvpAttr enum. If the type cannot be determined PVMI_KVPATTR_UNKNOWN will be returned
     54  */
     55 OSCL_IMPORT_REF PvmiKvpAttr GetAttrTypeFromKeyString(PvmiKeyType aKeyString);
     56 
     57 /**
     58  * This function returns the value type parameter ("valtype=") index for the input key string
     59  *
     60  * @param aKeyString      The input key string to determine the value type parameter
     61  * @returns               One of PvmiKvpValueType enum. If the type cannot be determined PVMI_KVPVALTYPE_UNKNOWN will be returned
     62  */
     63 OSCL_IMPORT_REF PvmiKvpValueType GetValTypeFromKeyString(PvmiKeyType aKeyString);
     64 
     65 
     66 class PVMFCreateKVPUtils
     67 {
     68     public:
     69         OSCL_IMPORT_REF static PVMFStatus CreateKVPForWStringValue(PvmiKvp& aKeyVal,
     70                 const char* aKeyTypeString,
     71                 OSCL_wString& aValString,
     72                 char* aMiscKeyParam = NULL,
     73                 uint32 aMaxSize = 0xFFFFFFFF,
     74                 uint32 aTruncateFlag = 1);
     75 
     76         OSCL_IMPORT_REF static PVMFStatus CreateKVPForCharStringValue(PvmiKvp& aKeyVal,
     77                 const char* aKeyTypeString,
     78                 const char* aValString,
     79                 char* aMiscKeyParam = NULL,
     80                 uint32 aMaxSize = 0xFFFFFFFF,
     81                 uint32 aTruncateFlag = 1);
     82 
     83         OSCL_IMPORT_REF static PVMFStatus CreateKVPForByteArrayValue(PvmiKvp& aKeyVal,
     84                 const char* aKeyTypeString,
     85                 uint8* aValue,
     86                 uint32 aValueLen,
     87                 char* aMiscKeyParam = NULL,
     88                 uint32 aMaxSize = 0xFFFFFFFF);
     89 
     90         OSCL_IMPORT_REF static PVMFStatus CreateKVPForUInt32Value(PvmiKvp& aKeyVal,
     91                 const char* aKeyTypeString,
     92                 uint32& aValueUInt32,
     93                 char* aMiscKeyParam = NULL);
     94 
     95         OSCL_IMPORT_REF static PVMFStatus CreateKVPForFloatValue(PvmiKvp& aKeyVal,
     96                 const char* aKeyTypeString,
     97                 float& aValueFloat,
     98                 char* aMiscKeyParam = NULL);
     99 
    100         OSCL_IMPORT_REF static PVMFStatus CreateKVPForBoolValue(PvmiKvp& aKeyVal,
    101                 const char* aKeyTypeString,
    102                 bool& aValueBool,
    103                 char* aMiscKeyParam = NULL);
    104 
    105         OSCL_IMPORT_REF static PVMFStatus CreateKVPForKSVValue(PvmiKvp& aKeyVal,
    106                 const char* aKeyTypeString,
    107                 OsclAny* aValue,
    108                 char* aMiscKeyParam = NULL);
    109 
    110 };
    111 
    112 #endif //PVMI_KVP_UTIL_H_INCLUDED
    113 
    114