• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 OSCL_CONFIGFILE_LIST_H_INCLUDED
19 #define OSCL_CONFIGFILE_LIST_H_INCLUDED
20 
21 #ifndef OSCL_MEM_H_INCLUDED
22 #include "oscl_mem.h"
23 #endif
24 
25 #ifndef OSCL_STRING_CONTAINERS_H_INCLUDED
26 #include "oscl_string_containers.h"
27 #endif
28 
29 #ifndef OSCL_VECTOR_H_INCLUDED
30 #include "oscl_vector.h"
31 #endif
32 
33 #ifndef OSCL_LIBRARY_COMMON_H_INCLUDED
34 #include "oscl_library_common.h"
35 #endif
36 
37 struct OsclUuid;
38 class PVLogger;
39 
40 /**
41 * OsclConfigFileList contains the list of .cfg files found from a given directory
42 **/
43 class OsclConfigFileList
44 {
45     public:
46         enum SortType
47         {
48             ESortByName = 0,
49             ENoSort
50         };
51 
52         /**
53          * Default object Constructor function
54          **/
55         OSCL_IMPORT_REF OsclConfigFileList();
56 
57         /**
58          * Object destructor function
59          **/
60         OSCL_IMPORT_REF ~OsclConfigFileList();
61 
62         /**
63          * Populate the list for the given directory.
64          *
65          * @param aConfigFileDir - directory path of the .cfg files; path can trail with or without delimiter (path prefix, e.g. '\')
66          * @param aSortType - Define type type of sort, if any, for the config file list. Default is not sorted
67          *
68          * @returns OsclLibStatus about whether the config file vector got populated or not
69          **/
70         OSCL_IMPORT_REF OsclLibStatus Populate(const OSCL_String& aConfigFileDir,
71                                                OsclConfigFileList::SortType aSortType = ENoSort);
72 
73         /**
74         * Get the number of config file in the list.
75         *
76         * @returns Number of config file in list.
77         */
78         OSCL_IMPORT_REF uint32 Size();
79 
80         /**
81          * Returns the n'th element.
82          * @param n element position to return
83          * @returns the reference to the config file name stored in the iCfgList vector
84          */
85         OSCL_IMPORT_REF const OSCL_String& GetConfigfileAt(uint32 n);
86 
87 
88     private:
89         Oscl_Vector<OSCL_HeapString<OsclMemAllocator>, OsclMemAllocator> iCfgList;
90         PVLogger* ipLogger;
91 #if OSCL_LIBRARY_PERF_LOGGING
92         PVLogger* iDiagnosticsLogger;
93         uint32 iCfgFileNum;
94 #endif
95 
96         /**
97          * Sort iCfgList by name
98          */
99         void Sort(void);
100 };
101 
102 /**
103 * OsclLibraryUtil is mainly used by test app to setup library search path
104 **/
105 class OsclLibraryUtil
106 {
107     public:
108         /**
109          * static api sets, appends, or unset aDir to system PATH environment as the lib search folder
110          *
111          * @param aEnvName - environment name to be set or unset
112          * @param aEnvValue - environment value of the aEnvName to be set or unset
113          *
114          * @returns OsclLibStatus
115          **/
116         OSCL_IMPORT_REF static OsclLibStatus SetupLibraryEnv(const char* aEnvName, const char* aEnvValue);
117 };
118 
119 #endif //OSCL_LIBRARY_LIST_H_INCLUDED
120 
121