Tizen 开发 - Base: Providing Fundamental Classes

Base: Providing Fundamental Classes
1. Basic data types
1)Tizen::Base::Number实现了char, short, int, long, long long, float, double, bool,除bool外可以通过各自的函数相互转化。
2)Buffer
ByteBuffer可以由String生成
Tizen::Base::Utility::StringUtil的函数
static ByteBuffer * StringToUtf8N (const String &unicodeString);

3)DateTime and TimeSpan
4)String
创建String
// From a C string
char* pStr = "ABC";
String str(pStr);

Tizen::Base::Utility::StringUtil::Utf8ToString(const char *pUtf8String, String &unicodeString)

// From a Unicode string 
String str1(L"test");


// From another string
String* str2;       
str2 = L"Hello";    
String str3(str2);


// From Unicode character
wchar_t chr = L'A';
String str4(chr);

5)UuId (Universally Unique Identifier)可以与String相互转化

2. Collections
1) 设置删除器
设置删除器为SingleObjectDeleter,collection可以删除里面的元素;
设置删除器为NoOpDeleter (默认值),collection不能删除里面的元素;
也可以不用设置删除器,而使用forceDeletion 调用RemoveAll来删除,如果同时使用了,则以后者为准;
such as:
Class MyClass:
   public Object
{
   ~MyClass();
   void CleanUp();
   …
}


// Define the custom element deleter, MyClassDeleter
void
MyClassDeleter(Object* pObj)
{
   // Check for null as necessary
   if (pObj != null)
   {
      MyClass* pMyClass = dynamic_cast< MyClass* >(pObj);
      pMyClass->CleanUp();
      delete pObj;
   }
}


// Set the element deleter to MyClassDeleter
ArrayList list(MyClassDeleter);


// Destructor of ArrayList calls RemoveAll() and RemoveAll() calls MyClassDeleter();
// when the ArrayList instance goes out of scope, 
// all containing elements are automatically cleaned up
}

2) Collections Categories
Object-based collections
ArrayList list;
list.Construct();
   
String* pStr = new String(L"One"); // Use heap variables with collections
list.Add(pStr); 

Template-based collections,主要用于基本类型
ArrayListT<int> list;
list.Construct();
int value = 10;
list.Add(value);

3)ArrayList and LinkedList
4)HashMap and MultiHashMap
5)Stack and Queue
6)StlConverter 将Tizen collection转换成STL 容器,反之亦然
7)Collection Comparisons 比较器

3. Runtime Environment
1) Thread
顺序执行的worker thread
带循环的事件驱动thread
Main Thread of the application


2)共享对象的同步访问
mutex
semaphore
monitor

4. Utilities
1) Math utilities
2) String-related utilities
3) URI utilities
4) Inflation and deflation utilities
5) URL encoding and decoding utilities
6) File zipping utilities
7) Regular expression utilities

你可能感兴趣的:(Tizen 开发 - Base: Providing Fundamental Classes)