ADD_DEFINITIONS("-DLINUX")
ELSEIF(_WIN32)
-SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -g -O0 -fvisibility=default")
-SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -g -O0 -fvisibility=default")
+SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -w -g -O0 -fvisibility=default")
+SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w -g -O0 -fvisibility=default")
ADD_DEFINITIONS("-D_WIN32")
ADD_SUBDIRECTORY(example/Plugin)
ELSEIF(LINUX)
ADD_SUBDIRECTORY(example/Linux)
+ADD_SUBDIRECTORY(example/Plugin)
ENDIF(_WIN32)
int main(void)
{
+ printf("HELLO!!!!");
Application application;
application.CreateLayer();
../../inc
../../src/base/inc
../../src/graphics/inc
+ ../../src/base/inc/collection
+ ../../src/base/inc/runtime
+ ../../src/graphics/inc
${UIFW_DIRECTORY}/inc
)
SET(${this_target}_SOURCE_FILES
+ j_utils.cpp
org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.cpp
)
--- /dev/null
+#include <stdio.h>\r
+#include <iostream>\r
+#include "j_utils.h"\r
+\r
+/*\r
+#ifdef _apl\r
+#include <mach/clock.h>\r
+#include <mach/mach.h>\r
+#else\r
+#ifndef __LINUX\r
+#include <windows.h>\r
+LARGE_INTEGER proc_freq;\r
+#endif\r
+#endif\r
+\r
+long long __t1;\r
+bool firstLunch = true;\r
+long long sumt = 0; //DEBUG!*/\r
+JNIEnv * env = NULL;\r
+\r
+void logMessage(const char* message){\r
+ \r
+ if (env == NULL)\r
+ {\r
+ printf("%s\n", message);\r
+ return;\r
+ }\r
+ jclass clsH = env->FindClass("org/tizen/tools/areditor/sceneeditor/editor3d/NativeSceneEditor");\r
+ if (clsH == NULL)\r
+ {return;}\r
+ jmethodID midCalling = env->GetStaticMethodID(clsH,"log","(Ljava/lang/String;)V");\r
+ if (midCalling == NULL)\r
+ {return;}\r
+ jstring StringArg = env->NewStringUTF(message);\r
+ if (StringArg == NULL)\r
+ {return;}\r
+ env->CallStaticVoidMethod(clsH,midCalling,StringArg);\r
+}\r
+\r
+void setJenv(JNIEnv * new_env){\r
+ env = new_env;\r
+}\r
+\r
+std::string toCString(jstring jstr){\r
+ std::string cstr = "";\r
+ if(jstr != NULL){\r
+ const char *tmp = (env)->GetStringUTFChars(jstr, 0);\r
+ cstr = tmp;\r
+ (env)->ReleaseStringUTFChars(jstr, tmp);\r
+ }\r
+ return(cstr);\r
+}\r
+\r
+jstring toJString(char* chr){\r
+ return ( (env)->NewStringUTF(chr) );\r
+}\r
+\r
+jstring toJString(const std::string s){\r
+ return ( (env)->NewStringUTF(s.c_str()) );\r
+}
\ No newline at end of file
--- /dev/null
+\r
+#include <jni.h>\r
+#include <string>\r
+\r
+void logMessage(const char* message);\r
+void setJenv(JNIEnv * new_env);\r
+std::string toCString(jstring jstr);\r
+jstring toJString(char* chr);\r
+jstring toJString(const std::string s);
\ No newline at end of file
-#include "org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.h"
-#include <jni_md.h>
-#include <UcApplication.h>
-#include <FGrpFloatDimension.h>
-
-using namespace UiCore;
-using namespace Tizen::Graphics;
-
-Application application;
-
-JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_init(JNIEnv *, jobject, jint handle, jint width, jint height)
-{
- application.CreateLayer(handle);
-}
-
-JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_resize(JNIEnv *, jobject, jint width, jint height)
-{
- application.SetLayerSize(FloatDimension(width, height));
-}
-
-JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_repaint(JNIEnv *, jobject, jfloat dt)
-{
- application.UpdateLayer();
-}
-
+// jniSceneEditor.cpp : Defines the entry point for the console application.\r
+//\r
+\r
+\r
+#include "stdafx.h"\r
+\r
+#include <iostream>\r
+#include "org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor.h"\r
+#include <jni_md.h>\r
+#include <direct.h>\r
+#include <iterator>\r
+\r
+#include "Scene.h"\r
+#include "ModelBuilder.h"\r
+#include "NodeScene.h"\r
+\r
+#include "RenderSystem.h"\r
+#include "GpuProgram.h"\r
+#include "Surface.h"\r
+#include "Material.h"\r
+#include "Camera.h"\r
+#include "Vector3.h"\r
+#include "resource-manager/ResourceManager.h"\r
+#include "PrefabBox.h"\r
+#include "j_utils.h"\r
+#include "at-entities/GizmoManager.h"\r
+\r
+using namespace Tizen::Ui::Renderer;\r
+using namespace Tizen::Ui::Animations::VisualScenes::_Interactive3DModel;\r
+using namespace Tizen::Ui::Animations::VisualScenes::_Scene;\r
+using namespace Tizen::Ui::Animations::VisualScenes::_ResourceManager;\r
+using namespace Tizen::Ui::Animations::VisualScenes::_Math;\r
+using namespace Tizen::Ui::Core;\r
+\r
+\r
+class Tmp : public Application\r
+{\r
+};\r
+REG_CLASS(Tmp);\r
+\r
+HDC gg_hDC; // the device context (DC)\r
+\r
+Scene* __pScene = NULL;\r
+Tizen::Ui::Renderer::RenderSystem* __pRenderSystem;\r
+\r
+Uint width;\r
+Uint height;\r
+\r
+Mesh* __mesh1;\r
+NodeScene* __pMeshNode1;\r
+Grid __pGrid;\r
+\r
+\r
+//---------------------------------\r
+Tizen::Ui::Animations::VisualScenes::_Scene::NodeScene* __pPicking;\r
+int lastMouseDownX = -1;\r
+int lastMouseDownY = -1;\r
+bool isGizmoDraging = false;\r
+//---------------------------------\r
+//Material* __pMaterial;\r
+\r
+\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setDataPath\r
+ (JNIEnv *env, jobject obj, jstring currentPath){\r
+ setJenv(env);\r
+ if(currentPath != NULL){\r
+ const char *currentDir = (env)->GetStringUTFChars(currentPath, 0);\r
+ int res = _chdir(currentDir);\r
+ (env)->ReleaseStringUTFChars(currentPath, currentDir);\r
+ }\r
+}\r
+\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_init\r
+ (JNIEnv *, jobject, jint handle, jint width, jint height){\r
+ CreateContext ( (HWND)handle, width, height );\r
+\r
+ // get the device context (DC)\r
+ gg_hDC = GetDC( (HWND)handle );\r
+\r
+ //OnInit\r
+ ResourceManager* resourceManager = ResourceManager::GetInstance();\r
+ __pScene = new Scene("Scene");\r
+\r
+ __pRenderSystem = new Tizen::Ui::Renderer::RenderSystem();\r
+ __pRenderSystem->Create();\r
+ __pRenderSystem->SetBackgroundColor(1.0f, 0.2f, 0.2f, 0.2f);\r
+ __pRenderSystem->InitViewport(0, 0, width, height, 45.0f, 0.1f, 1000.0f);\r
+ __pRenderSystem->UpdateScreen();\r
+\r
+ __pRenderSystem->GetCamera()->Perspective(45.0f, (float)width / height, 0.1f, 1000.0f);\r
+ __pRenderSystem->GetCamera()->LookAt(Vector3(0, 0, 100), Vector3(0, 0, 0), Vector3(0, 1, 0));\r
+ \r
+ __pScene->Update();\r
+\r
+ \r
+ //Tizen::Ui::Renderer:: __Config::ShaderPath = "Shaders/";//"../Data/Shaders/";\r
+ //Tizen::Ui::Renderer::__Config::MaterialPath = "Materials/";//"../Data/Materials/";\r
+ FileSystem::ShaderPath = "Shaders/";\r
+ FileSystem::MaterialPath = "Materials/";\r
+ FileSystem::TexturePath = "Textures/";\r
+\r
+\r
+ std::string ModelFileName1 = "ColladaModels/ColorCube.dae";//"../../../Demos/ColladaModels/ColorCube.dae";\r
+ std::string ModelFileName2 = "ColladaModels/scorpion_.DAE";//"../../../Demos/ColladaModels/scorpion_.DAE";\r
+ std::string ModelFileName3 = "ColladaModels/lizard_animation_1.DAE";//"../../../Demos/ColladaModels/lizard_animation_1.DAE";\r
+ std::string ModelFileName4 = "ColladaModels/astroBoy_walk_Maya.dae";//"../../../Demos/ColladaModels/astroBoy_walk_Maya.dae";\r
+\r
+ __pGrid.SetLines ( 5.0f, 10.0f, 50.0f );\r
+ __pGrid.Create ( __pRenderSystem );\r
+ GizmoManager::Setting(__pScene,__pRenderSystem);\r
+\r
+ /*std::string materialFileName = Tizen::Ui::Fs::FileSystem::MaterialPath + "light.xml";\r
+ __pMaterial = ResourceManager::GetInstance()->LoadMaterial( materialFileName, "" );\r
+ __pMaterial->Create ();*/\r
+\r
+ glEnable(GL_DEPTH_TEST);\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_resize\r
+ (JNIEnv *, jobject, jint width, jint height){\r
+ __pRenderSystem->InitViewport ( 0, 0, width, height);\r
+ __pRenderSystem->GetCamera()->Perspective(45.0f, (float)width / height, 0.1f, 1000.0f);\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_repaint\r
+ (JNIEnv *, jobject, jfloat dt){\r
+ //////////////////////////////Update////////////////////////////////////////////////////\r
+ float fElapsedTime = dt;\r
+// static float angle = 0;\r
+// angle += fElapsedTime;\r
+\r
+// __pRenderSystem->SetViewMatrix(__pRenderSystem->GetCamera()->GetView());\r
+ __pRenderSystem->SetProjectionMatrix(__pRenderSystem->GetCamera()->GetProjection());\r
+ __pScene->Update();\r
+\r
+ Matrix4 mat;\r
+ mat.Identity();\r
+ __pGrid.WorldMatrix = mat;\r
+ __pGrid.Update( fElapsedTime );\r
+\r
+\r
+ ///////////////////// Draw //////////////////////////////////////////////////////////////////////\r
+ __pRenderSystem->Clear(ClearFlag::COLOR | ClearFlag::ZBUFFER | ClearFlag::STENCIL);\r
+\r
+ __pScene->FindVisible(__pRenderSystem, __pScene->GetRootNodeScene());\r
+\r
+ __pRenderSystem->BeginRender();\r
+ __pRenderSystem->RenderStages();\r
+ __pRenderSystem->EndRender();\r
+\r
+ GizmoManager::Render();\r
+ SwapBuffers(gg_hDC);\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_mouseUp\r
+ (JNIEnv *, jobject, jint mouseX, jint mouseY, jint){\r
+ //logMessage(__pPicking->);\r
+ /*__pPicking = __pScene->PickNodeScene(mouseX, mouseY,__pRenderSystem->GetCamera()->GetProjectionViewInv(),__pRenderSystem->GetFrame());\r
+ if(__pPicking != null)\r
+ {\r
+ logMessage( __pPicking->GetName().c_str());\r
+ \r
+ }else{\r
+ logMessage("Empty picking");\r
+ }\r
+ \r
+ if(isGizmoDraging){*/\r
+ isGizmoDraging = false;\r
+ /*}else{\r
+ GizmoManager::AttachGizmo(__pPicking);\r
+ }*/\r
+ \r
+\r
+ //--------------------------------\r
+ lastMouseDownX = -1;\r
+ lastMouseDownY = -1;\r
+ GizmoManager::Reset();\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_mouseDown\r
+ (JNIEnv *, jobject, jint mouseX, jint mouseY, jint){\r
+ lastMouseDownX = mouseX;\r
+ lastMouseDownY = mouseY;\r
+\r
+ __pPicking = __pScene->PickNodeScene(mouseX, mouseY,__pRenderSystem->GetCamera()->GetProjectionViewInv(),__pRenderSystem->GetFrame());\r
+ if(__pPicking != null)\r
+ {\r
+ logMessage( __pPicking->GetName().c_str());\r
+ \r
+ }else{\r
+ logMessage("Empty picking");\r
+ }\r
+ \r
+ if(!isGizmoDraging){\r
+ GizmoManager::AttachGizmo(__pPicking);\r
+ }\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_dispose\r
+ (JNIEnv *, jobject){\r
+// delete __pScene;\r
+// __pScene = NULL;\r
+ SafeDelete(__pScene);\r
+\r
+// delete __pRenderSystem;\r
+// __pRenderSystem = NULL;\r
+ SafeDelete(__pRenderSystem);\r
+ \r
+ ResourceManager* resourceManager = ResourceManager::GetInstance();\r
+ resourceManager->UnloadAllMaterials();\r
+ resourceManager->UnloadAllMeshes();\r
+ GizmoManager::Destroy();\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_addModel\r
+ (JNIEnv * env, jobject, jstring filePath, jstring modelName, jstring materialName, jstring nodeName, jint x, jint y){\r
+// setJenv(env);\r
+ if ( filePath == NULL || modelName == NULL || nodeName == NULL) {\r
+ logMessage("NULL!!!");\r
+ return;\r
+ }\r
+\r
+ std::string fileName = toCString(filePath);\r
+ std::string modelID = toCString(modelName);\r
+ std::string materialID = toCString(materialName);\r
+ std::string nodeID = toCString(nodeName);\r
+\r
+ std::string materialFileName = FileSystem::MaterialPath + materialID;\r
+ ResourceManager* resourceManager = ResourceManager::GetInstance();\r
+ MaterialDescription* __pMaterial = resourceManager->LoadMaterial( materialFileName, "" );\r
+ __pMaterial->Create ();\r
+\r
+ Vector3 Normal(0,1,0);\r
+\r
+ Vector3 P1 = __pScene->ConvertScreenToWorld(Vector3(x, y, 1.0f), __pRenderSystem->GetCamera()->GetProjectionView().GetInversed(), __pRenderSystem->GetFrame());\r
+ Vector3 P2 = __pScene->ConvertScreenToWorld(Vector3(x, y, 0.0f), __pRenderSystem->GetCamera()->GetProjectionView().GetInversed(), __pRenderSystem->GetFrame());\r
+ Vector3 Ray = P1 - P2;\r
+ Vector3 Rayt;\r
+ float num = -(Normal.x * P1.x + Normal.y * P1.y + Normal.z * P1.z);\r
+ \r
+ float denum = (Normal.x * Ray.x + Normal.y * Ray.y + Normal.z * Ray.z);\r
+ float t = num / denum;\r
+ if (fabs(denum) < 0.1)\r
+ {\r
+ //TODO\r
+ }\r
+ else\r
+ {\r
+ Rayt = P1 + Ray*t;\r
+ }\r
+ \r
+ \r
+\r
+ NodeScene* rootNode = __pScene->GetRootNodeScene();\r
+// logMessage(nodeID.c_str());\r
+// logMessage(fileName.c_str());\r
+\r
+ __mesh1 = resourceManager->LoadMesh(fileName, modelID);\r
+// __mesh1->Create(__pRenderSystem);\r
+ __mesh1->SetMaterial(__pMaterial);\r
+\r
+ __pMeshNode1 = rootNode->CreateChildNodeScene(nodeID);\r
+ __pMeshNode1->AddAttachable(__mesh1);\r
+ //Rayt.z = -Rayt.z;\r
+ __pMeshNode1->SetPosition(Rayt);\r
+ __pMeshNode1->SetOrientation(0, 1, 1, 1);\r
+ __pMeshNode1->SetScale(Vector3(3, 3, 3));\r
+}\r
+\r
+/*JNIEXPORT jobjectArray JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getChildrenList\r
+ (JNIEnv * env, jobject, jstring name){\r
+ std::string nodeName = toCString(name);\r
+ jobjectArray ret;\r
+ int n = 0;\r
+\r
+ jstring names[50];\r
+\r
+ if (nodeName == ""){\r
+ NodeScene* rootNode = __pScene->GetRootNodeScene();\r
+ Node::ChildrenIt itEnd = rootNode->GetChildrenEnd();\r
+ for (Node::ChildrenIt it = rootNode->GetChildrenBegin(); it != itEnd; ++it)\r
+ {\r
+ NodeScene* ns = static_cast<NodeScene*>(it->second);\r
+\r
+ const std::string& name = ns->GetName();\r
+ names[n++] = toJString(name);\r
+ }\r
+ }\r
+\r
+ ret= (jobjectArray)env->NewObjectArray(n,\r
+ env->FindClass("java/lang/String"),\r
+ env->NewStringUTF(""));\r
+\r
+ for (int i=0;i<n;i++) {\r
+ env->SetObjectArrayElement(ret,i, names[i]);\r
+ }\r
+ return(ret);\r
+}*/\r
+\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_mouseScrolled\r
+ (JNIEnv * env, jobject, jint counts){\r
+ setJenv(env);\r
+// logMessage("Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_mouseScrolled");\r
+ __pRenderSystem->GetCamera()->Zoom(counts);\r
+\r
+\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_dragDetected\r
+ (JNIEnv *, jobject, jint, jint, jint, jint){\r
+\r
+}\r
+\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_mouseMove\r
+ (JNIEnv *, jobject, jint x, jint y, jint, jint){\r
+ \r
+ \r
+ //--------------------------------------------------------------\r
+ //----------------Work with Gizmo------------------------------\r
+\r
+ if((lastMouseDownX != -1)|| (lastMouseDownY != -1))\r
+ {\r
+ isGizmoDraging = true;\r
+ GizmoManager::ApplyGizmo(x,y,lastMouseDownX,lastMouseDownY);\r
+ \r
+ if(lastMouseDownX != x)\r
+ lastMouseDownX = x;\r
+\r
+ if(lastMouseDownY != y)\r
+ lastMouseDownY = y;\r
+ }\r
+ else\r
+ {\r
+ GizmoManager::Reset();\r
+ }\r
+ //--------------------------------------------------------------\r
+ //--------------------------------------------------------------\r
+\r
+ \r
+\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_moveSceneCamera\r
+ (JNIEnv * env, jobject, jint deltaX, jint deltaY, jint stateMask){\r
+ setJenv(env);\r
+// logMessage("Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_moveSceneCamera");\r
+ float magicNumder = -0.1f;\r
+ __pRenderSystem->GetCamera()->Pan(magicNumder * deltaX, magicNumder * deltaY);\r
+ \r
+\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_rotateSceneCamera\r
+ (JNIEnv * env, jobject, jint x, jint y, jint stateMask){\r
+ setJenv(env);\r
+// logMessage("Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_rotateSceneCamera");\r
+ float magicNumder = -0.5f;\r
+ /*Vector3 tempVector = __pRenderSystem->GetCamera()->GetPosition();\r
+ tempVector += Vector3((float)x, 0.0f, 0.0f);\r
+\r
+ __pRenderSystem->GetCamera()->LookAt(tempVector, Vector3(0, 0, 0), Vector3(0, 1, 0));*/\r
+ __pRenderSystem->GetCamera()->Rotate(DegToRad(magicNumder * x),DegToRad(magicNumder * y));\r
+ \r
+}\r
+\r
+JNIEXPORT jintArray JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getChildrenListRef\r
+ (JNIEnv * env, jobject, jint handle){\r
+ //std::string nodeName = toCString(name);\r
+ jintArray ret;\r
+ int n = 0;\r
+ jint handles[50];\r
+\r
+ if (handle == 0){\r
+ NodeScene* rootNode = __pScene->GetRootNodeScene();\r
+ Node::ChildrenIt itEnd = rootNode->GetChildrenEnd();\r
+ for (Node::ChildrenIt it = rootNode->GetChildrenBegin(); it != itEnd; ++it)\r
+ {\r
+ NodeScene* ns = static_cast<NodeScene*>(it->second);\r
+ int test = (int)ns;\r
+\r
+ handles[n++] = test;\r
+ }\r
+ } else {\r
+ NodeScene* ns = (NodeScene*)handle;\r
+ Node::ChildrenIt itEnd = ns->GetChildrenEnd();\r
+ for (Node::ChildrenIt it = ns->GetChildrenBegin(); it != itEnd; ++it)\r
+ {\r
+ NodeScene* ns = static_cast<NodeScene*>(it->second);\r
+ int test = (int)ns;\r
+\r
+ handles[n++] = test;\r
+ }\r
+ }\r
+\r
+ ret = env->NewIntArray(n);\r
+ env->SetIntArrayRegion(ret, 0, n, handles);\r
+\r
+ return(ret);\r
+}\r
+\r
+\r
+JNIEXPORT jstring JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getName\r
+ (JNIEnv * env, jobject, jint handle){\r
+ NodeScene* ns = (NodeScene*)handle;\r
+ const std::string& name = ns->GetName();\r
+ return toJString(name);\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_addNode\r
+ (JNIEnv *, jobject, jstring nodeName, jint handle){\r
+ std::string name = toCString(nodeName);\r
+\r
+ ResourceManager* resourceManager = ResourceManager::GetInstance();\r
+ NodeScene* rootNode = __pScene->GetRootNodeScene();\r
+\r
+ if (handle == 0) {\r
+ __pMeshNode1 = rootNode->CreateChildNodeScene(name);\r
+ } else {\r
+ NodeScene* ns = (NodeScene*)handle;\r
+ ns->CreateChildNodeScene(name);\r
+ }\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_deleteNode\r
+ (JNIEnv *, jobject, jint handle){\r
+ NodeScene* ns = (NodeScene*)handle;\r
+ // ns->DestroyAllChildren();\r
+ //Node* ps = ns->GetParent();\r
+ //ps->RemoveChild(ns->GetName());\r
+\r
+ __pScene->DestroyNodeScene(ns->GetName());\r
+// SafeDelete(ns);\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_moveNode\r
+ (JNIEnv *, jobject, jint elhandle, jint desthandle){\r
+ NodeScene* node = (NodeScene*)elhandle;\r
+\r
+ Node* parent = node->GetParent();\r
+ parent->RemoveChild(node->GetName());\r
+\r
+ NodeScene* dest;\r
+ if (desthandle == 0){\r
+ dest = __pScene->GetRootNodeScene();\r
+ } else {\r
+ dest = (NodeScene*)desthandle;\r
+ }\r
+ dest->AddChild(node);\r
+}\r
+\r
+/*\r
+ Show selection on parts in aray\r
+*/\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setSelection\r
+ (JNIEnv * env, jobject, jintArray handles){\r
+ //GizmoManager::Deattach();\r
+\r
+ jint *inCArray = env->GetIntArrayElements( handles, NULL);\r
+ //if (NULL == inCArray) return NULL;\r
+ jsize length = env->GetArrayLength(handles);\r
+\r
+ NodeScene* node = (NodeScene*)inCArray[0];\r
+\r
+ GizmoManager::AttachGizmo(node);\r
+\r
+ env->ReleaseIntArrayElements(handles, inCArray, 0);\r
+}\r
+\r
+/*\r
+Get node's describing matrix\r
+*/\r
+JNIEXPORT jfloatArray JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getNodeTransform\r
+ (JNIEnv * env, jobject, jint handle){\r
+ NodeScene* node = (NodeScene*)handle;\r
+\r
+ jfloatArray ret;\r
+ int n = 9;\r
+ jfloat retint[9];\r
+\r
+ Vector3 __Tmp;\r
+ Matrix4 __TmpM;\r
+ bool __Local=true;\r
+ float __XangleRAD;\r
+ float __YangleRAD;\r
+ float __ZangleRAD;\r
+ float __XangleDEG;\r
+ float __YangleDEG;\r
+ float __ZangleDEG;\r
+\r
+ if(__Local)\r
+ {\r
+ __Tmp = node->GetPosition();\r
+ retint[0] = __Tmp.x;\r
+ retint[1] = __Tmp.y;\r
+ retint[2] = __Tmp.z;\r
+\r
+ __TmpM = node->GetOrientation();\r
+ __TmpM.GetRotationAngles(__XangleRAD,__YangleRAD,__ZangleRAD);\r
+\r
+ __XangleDEG = FRadians2Degrees(__XangleRAD);\r
+ __YangleDEG = FRadians2Degrees(__YangleRAD);\r
+ __ZangleDEG = FRadians2Degrees(__ZangleRAD);\r
+\r
+ retint[3] = __XangleDEG;\r
+ retint[4] = __YangleDEG;\r
+ retint[5] = __ZangleDEG;\r
+\r
+ __Tmp = node->GetScale();\r
+ retint[6] = __Tmp.x;\r
+ retint[7] = __Tmp.y;\r
+ retint[8] = __Tmp.z;\r
+ }\r
+ else\r
+ {\r
+ __Tmp = node->GetDerivedPosition();\r
+ retint[0] = __Tmp.x;\r
+ retint[1] = __Tmp.y;\r
+ retint[2] = __Tmp.z;\r
+\r
+ __TmpM = node->GetDerivedOrientation();\r
+ __TmpM.GetRotationAngles(__XangleRAD,__YangleRAD,__ZangleRAD);\r
+\r
+ __XangleDEG = FRadians2Degrees(__XangleRAD);\r
+ __YangleDEG = FRadians2Degrees(__YangleRAD);\r
+ __ZangleDEG = FRadians2Degrees(__ZangleRAD);\r
+\r
+ retint[3] = __XangleDEG;\r
+ retint[4] = __YangleDEG;\r
+ retint[5] = __ZangleDEG;\r
+\r
+ __Tmp = node->GetDerivedScale();\r
+ retint[6] = __Tmp.x;\r
+ retint[7] = __Tmp.y;\r
+ retint[8] = __Tmp.z;\r
+ }\r
+\r
+ ret = env->NewFloatArray(n);\r
+ env->SetFloatArrayRegion(ret, 0, n, retint);\r
+ return(ret);\r
+}\r
+\r
+/*\r
+Get node's mesh name\r
+*/\r
+JNIEXPORT jstring JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getMeshName\r
+ (JNIEnv *, jobject, jint handle){\r
+ NodeScene* node = (NodeScene*)handle;\r
+\r
+ string name = node->GetName();\r
+\r
+ return toJString(name);\r
+}\r
+\r
+/*\r
+Get node's mesh string\r
+*/\r
+JNIEXPORT jstring JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getMeshMaterial\r
+ (JNIEnv *, jobject, jint handle){\r
+ NodeScene* node = (NodeScene*)handle;\r
+ \r
+\r
+ return toJString("TEST");\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setName\r
+ (JNIEnv *, jobject, jint handle, jstring name) {\r
+ NodeScene* node = (NodeScene*)handle;\r
+ std::string cname = toCString(name);\r
+\r
+ node->SetName(cname);\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setNodePosition\r
+ (JNIEnv * env, jobject, jint handle, jfloatArray vec){\r
+ NodeScene* node = (NodeScene*)handle;\r
+ jfloat* flt1 = env->GetFloatArrayElements( vec,0);\r
+\r
+ Vector3 * pos = new Vector3(flt1[0], flt1[1], flt1[2]);\r
+ node->SetPosition(*pos);\r
+\r
+ env->ReleaseFloatArrayElements(vec, flt1, 0);\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setNodeRotation\r
+ (JNIEnv * env, jobject, jint handle, jfloatArray vec){\r
+ NodeScene* node = (NodeScene*)handle;\r
+ jfloat* flt1 = env->GetFloatArrayElements( vec,0);\r
+ Matrix4 __TmpM;\r
+ float __XangleRAD;\r
+ float __YangleRAD;\r
+ float __ZangleRAD;\r
+\r
+ //Vector3 * rotation = new Vector3(flt1[0], flt1[1], flt1[2]);\r
+ //?????????????????????????????????????????????????????????????????\r
+ __TmpM = node->GetOrientation();\r
+ __TmpM.GetRotationAngles(__XangleRAD,__YangleRAD,__ZangleRAD);\r
+ \r
+ //node->Rotate(-__XangleRAD,1,0,0);\r
+ //node->Rotate(-__YangleRAD,0,1,0);\r
+ //node->Rotate(-__ZangleRAD,0,0,1);\r
+\r
+ node->Rotate(-__ZangleRAD,0,0,1);\r
+ node->Rotate(-__YangleRAD,0,1,0);\r
+ node->Rotate(-__XangleRAD,1,0,0);\r
+\r
+ __XangleRAD = FDegrees2Radians(flt1[0]);\r
+ __YangleRAD = FDegrees2Radians(flt1[1]);\r
+ __ZangleRAD = FDegrees2Radians(flt1[2]);\r
+ \r
+ node->Rotate(__XangleRAD,1,0,0);\r
+ node->Rotate(__YangleRAD,0,1,0);\r
+ node->Rotate(__ZangleRAD,0,0,1);\r
+\r
+ env->ReleaseFloatArrayElements(vec, flt1, 0);\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setNodeScale\r
+ (JNIEnv * env, jobject, jint handle, jfloatArray vec){\r
+ NodeScene* node = (NodeScene*)handle;\r
+ jfloat* flt1 = env->GetFloatArrayElements( vec,0);\r
+\r
+ Vector3 * scale = new Vector3(flt1[0], flt1[1], flt1[2]);\r
+ node->SetScale(*scale);\r
+\r
+ env->ReleaseFloatArrayElements(vec, flt1, 0);\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setMeshName\r
+ (JNIEnv *, jobject, jint handle, jstring name){\r
+ NodeScene* node = (NodeScene*)handle;\r
+ std::string cname = toCString(name);\r
+\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setMeshMaterial\r
+ (JNIEnv *, jobject, jint handle, jstring material){\r
+ NodeScene* node = (NodeScene*)handle;\r
+ std::string cmaterial = toCString(material);\r
+\r
+}\r
+\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setGizmoMode\r
+ (JNIEnv *, jobject, jint mode, jboolean isOrientationLocal){\r
+ \r
+ GizmoOrientation newGizmoOrientation = GIZMO_ORIENTATION_GLOBAL;\r
+ if(isOrientationLocal){\r
+ newGizmoOrientation = GIZMO_ORIENTATION_LOCAL;\r
+ }\r
+\r
+ GizmoManager::SetMode((GizmoType)mode, newGizmoOrientation);\r
+}\r
+\r
+JNIEXPORT jobjectArray JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getAttachablesList\r
+ (JNIEnv* env, jobject _jobj, jint handle){\r
+ NodeScene* node_scene = (NodeScene*)handle; \r
+ node_scene->GetPropertyList();\r
+ int size=std::distance(node_scene->GetAttachablesBegin(), node_scene->GetAttachablesEnd());\r
+\r
+ jclass classString = (*env).FindClass("java/lang/String");\r
+\r
+ jobjectArray outJNIArray = (*env).NewObjectArray(size, classString, NULL); \r
+ \r
+ if (NULL == outJNIArray)\r
+ {\r
+ return NULL;\r
+ }\r
+\r
+ size=0;\r
+ for(std::map<std::string, Attachable*>::iterator itr=node_scene->GetAttachablesBegin(); itr!=node_scene->GetAttachablesEnd();itr++)\r
+ {\r
+ (*env).SetObjectArrayElement(outJNIArray, size, (*env).NewStringUTF(itr->first.c_str())); \r
+ size++;\r
+ }\r
+\r
+ return outJNIArray;\r
+\r
+}\r
+\r
+JNIEXPORT jobject JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getAttachableProperties\r
+ (JNIEnv * env, jobject jobj, jint handle, jstring _jstr){\r
+ logMessage("0");\r
+ jclass clsH = env->FindClass("org/tizen/tools/areditor/sceneeditor/transfer/Mesh");\r
+ if (clsH == NULL)\r
+ {\r
+ logMessage("clsHNULL");\r
+ }\r
+ logMessage("1");\r
+ jclass clsH_surf = env->FindClass("org/tizen/tools/areditor/sceneeditor/transfer/Surface");\r
+ if (clsH_surf == NULL)\r
+ {\r
+ logMessage("clsH_surfNULL");\r
+ }\r
+ logMessage("2");\r
+ jclass clsH_mater = env->FindClass("org/tizen/tools/areditor/sceneeditor/transfer/Material");\r
+ if (clsH_mater == NULL)\r
+ {\r
+ logMessage("clsH_materNULL");\r
+ }\r
+ logMessage("3");\r
+ jclass clsH_color = env->FindClass("org/tizen/tools/areditor/sceneeditor/transfer/Color");\r
+ if (clsH_color == NULL)\r
+ {\r
+ logMessage("clsH_colorNULL");\r
+ }\r
+ logMessage("4");\r
+ NodeScene* node_scene = (NodeScene*)handle; \r
+ logMessage("");\r
+ jmethodID MeshInit = (*env).GetMethodID(clsH, "<init>", "(Ljava/lang/String;)V");\r
+ if(MeshInit==NULL)\r
+ {\r
+ logMessage("MeshInitNULL");\r
+ }\r
+ logMessage("5");\r
+ jmethodID MeshAddSurf = (*env).GetMethodID(clsH, "addSurface", "(Lorg/tizen/tools/areditor/sceneeditor/transfer/Surface;)V");\r
+ if(MeshAddSurf==NULL)\r
+ {\r
+ logMessage("MeshAddSurfNULL");\r
+ }\r
+ logMessage("6");\r
+ jmethodID SurfInit = (*env).GetMethodID(clsH_surf, "<init>", "(Ljava/lang/String;)V");\r
+ if(SurfInit==NULL)\r
+ {\r
+ logMessage("SurfInitNULL");\r
+ }\r
+ logMessage("7");\r
+ jmethodID SurfSetMat = (*env).GetMethodID(clsH_surf, "setMaterial", "(Lorg/tizen/tools/areditor/sceneeditor/transfer/Material;)V");\r
+ if(SurfSetMat==NULL)\r
+ {\r
+ logMessage("SurfSetMatSurNULL");\r
+ }\r
+ logMessage("8");\r
+ jmethodID MatInit = (*env).GetMethodID(clsH_mater, "<init>", "(Ljava/lang/String;ZZZZIF)V");\r
+ if(MatInit==NULL)\r
+ {\r
+ logMessage("MatInitNULL");\r
+ }\r
+ logMessage("9");\r
+ jmethodID MatSetColor = (*env).GetMethodID(clsH_mater, "setColor", "(Lorg/tizen/tools/areditor/sceneeditor/transfer/Color;)V");\r
+ if(MatSetColor==NULL)\r
+ {\r
+ logMessage("MatSetColorNULL");\r
+ }\r
+ logMessage("1");\r
+ jmethodID ColorInit = (*env).GetMethodID(clsH_color, "<init>", "(FF)V");\r
+ if(ColorInit==NULL)\r
+ {\r
+ logMessage("ColorInitNULL");\r
+ }\r
+ logMessage("2");\r
+ jmethodID ColorAmbient = (*env).GetMethodID(clsH_color, "setAmbient", "(IIII)V");\r
+ if(ColorAmbient==NULL)\r
+ {\r
+ logMessage("ColorAmbientNULL");\r
+ }\r
+ logMessage("3");\r
+ jmethodID ColorDiffusive = (*env).GetMethodID(clsH_color, "setDiffuse", "(IIII)V");\r
+ if(ColorDiffusive==NULL)\r
+ {\r
+ logMessage("ColorDiffusiveNULL");\r
+ }\r
+ logMessage("4");\r
+ jmethodID ColorSpecular = (*env).GetMethodID(clsH_color, "setSpecular", "(IIII)V");\r
+ if(ColorSpecular==NULL)\r
+ {\r
+ logMessage("ColorSpecularNULL");\r
+ }\r
+ logMessage("5");\r
+ jmethodID ColorEmissive = (*env).GetMethodID(clsH_color, "setEmissive", "(IIII)V");\r
+ if(ColorEmissive==NULL)\r
+ {\r
+ logMessage("ColorEmissiveNULL");\r
+ }\r
+ logMessage("6");\r
+ jobject MaterObj=NULL;\r
+ jobject SurObj=NULL;\r
+ jobject MeshObj=NULL;\r
+ jobject ColorObj=NULL;\r
+ Attachable* _atchb = NULL;\r
+ logMessage("7");\r
+ for(std::map<std::string, Attachable*>::iterator itr=node_scene->GetAttachablesBegin(); itr!=node_scene->GetAttachablesEnd(); itr++)\r
+ {\r
+ if(std::string(itr->first.c_str()) == std::string(toCString(_jstr)))\r
+ {\r
+ _atchb = itr->second;\r
+ Mesh* _msh = (Mesh*)(_atchb);\r
+ std::vector<Surface*> _srf =_msh->GetSurfaces();\r
+ MeshObj = (*env).NewObject(clsH, MeshInit, _jstr);\r
+ for(int i = 0; i<_srf.size(); i++)\r
+ {\r
+ MaterialDescription* _mtrdesc = _srf[i]->GetMaterialPtr();\r
+ \r
+ ColorObj = (*env).NewObject(clsH_color, ColorInit, _mtrdesc->GetEmissiveFactor(), _mtrdesc->GetSpecularPower());\r
+ if(ColorObj==NULL)\r
+ {\r
+ logMessage("Color NULL");\r
+ }\r
+ \r
+ MaterObj = (*env).NewObject(clsH_mater, MatInit, env->NewStringUTF(_mtrdesc->GetName().c_str()), _mtrdesc->GetTransparent(), _mtrdesc->GetZBuffer(), _mtrdesc->GetZWrite(), _mtrdesc->GetAlphaTest(), _mtrdesc->GetAlphaTestRef(), _mtrdesc->GetOpacity());\r
+ if(MaterObj==NULL)\r
+ {\r
+ logMessage("Mater NULL");\r
+ }\r
+ \r
+ SurObj = (*env).NewObject(clsH_surf, SurfInit, env->NewStringUTF(_srf[0]->GetName().c_str())); \r
+ if(SurObj==NULL)\r
+ {\r
+ logMessage("SurNULL");\r
+ }\r
+ env->CallVoidMethod(ColorObj, ColorAmbient, _mtrdesc->GetAmbient().a, _mtrdesc->GetAmbient().b, _mtrdesc->GetAmbient().g, _mtrdesc->GetAmbient().r);\r
+ env->CallVoidMethod(ColorObj, ColorDiffusive, _mtrdesc->GetDiffuse().a, _mtrdesc->GetDiffuse().b, _mtrdesc->GetDiffuse().g, _mtrdesc->GetDiffuse().r);\r
+ env->CallVoidMethod(ColorObj, ColorSpecular, _mtrdesc->GetSpecular().a, _mtrdesc->GetSpecular().b, _mtrdesc->GetSpecular().g, _mtrdesc->GetSpecular().r);\r
+ env->CallVoidMethod(ColorObj, ColorEmissive, _mtrdesc->GetEmissive().a, _mtrdesc->GetEmissive().b, _mtrdesc->GetEmissive().g, _mtrdesc->GetEmissive().r);\r
+ env->CallVoidMethod(MaterObj, MatSetColor, ColorObj);\r
+ env->CallVoidMethod(SurObj, SurfSetMat, MaterObj);\r
+ env->CallVoidMethod(MeshObj, MeshAddSurf, SurObj);\r
+ }\r
+ }\r
+ }\r
+ logMessage("end");\r
+ return MeshObj;\r
+}\r
+\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setAttachableIntProperty\r
+ (JNIEnv *, jobject, jint, jstring, jstring, jstring, jint)\r
+{\r
+}\r
+\r
+T void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setAttachableStringProperty\r
+ (JNIEnv *, jobject, jint, jstring, jstring, jstring, jstring)\r
+{\r
+}\r
-/* DO NOT EDIT THIS FILE - it is machine generated */
-#include <jni.h>
-/* Header for class org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor */
-
-#ifndef _Included_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor
-#define _Included_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/*
- * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor
- * Method: init
- * Signature: (III)V
- */
-JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_init
- (JNIEnv *, jobject, jint, jint, jint);
-
-/*
- * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor
- * Method: resize
- * Signature: (II)V
- */
-JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_resize
- (JNIEnv *, jobject, jint, jint);
-
-/*
- * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor
- * Method: repaint
- * Signature: (F)V
- */
-JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_repaint
- (JNIEnv *, jobject, jfloat);
-
-
-#ifdef __cplusplus
-}
-#endif
-#endif
+/* DO NOT EDIT THIS FILE - it is machine generated */\r
+#include <jni.h>\r
+/* Header for class org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor */\r
+\r
+#ifndef _Included_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+#define _Included_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: setDataPath\r
+ * Signature: (Ljava/lang/String;)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setDataPath\r
+ (JNIEnv *, jobject, jstring);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: init\r
+ * Signature: (III)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_init\r
+ (JNIEnv *, jobject, jint, jint, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: resize\r
+ * Signature: (II)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_resize\r
+ (JNIEnv *, jobject, jint, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: repaint\r
+ * Signature: (F)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_repaint\r
+ (JNIEnv *, jobject, jfloat);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: mouseUp\r
+ * Signature: (III)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_mouseUp\r
+ (JNIEnv *, jobject, jint, jint, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: mouseDown\r
+ * Signature: (III)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_mouseDown\r
+ (JNIEnv *, jobject, jint, jint, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: dispose\r
+ * Signature: ()V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_dispose\r
+ (JNIEnv *, jobject);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: addModel\r
+ * Signature: (Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;II)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_addModel\r
+ (JNIEnv *, jobject, jstring, jstring, jstring, jstring, jint, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: dragDetected\r
+ * Signature: (IIII)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_dragDetected\r
+ (JNIEnv *, jobject, jint, jint, jint, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: mouseScrolled\r
+ * Signature: (I)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_mouseScrolled\r
+ (JNIEnv *, jobject, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: mouseMove\r
+ * Signature: (IIII)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_mouseMove\r
+ (JNIEnv *, jobject, jint, jint, jint, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: moveSceneCamera\r
+ * Signature: (III)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_moveSceneCamera\r
+ (JNIEnv *, jobject, jint, jint, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: rotateSceneCamera\r
+ * Signature: (III)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_rotateSceneCamera\r
+ (JNIEnv *, jobject, jint, jint, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: getChildrenListRef\r
+ * Signature: (I)[I\r
+ */\r
+JNIEXPORT jintArray JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getChildrenListRef\r
+ (JNIEnv *, jobject, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: getName\r
+ * Signature: (I)Ljava/lang/String;\r
+ */\r
+JNIEXPORT jstring JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getName\r
+ (JNIEnv *, jobject, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: addNode\r
+ * Signature: (Ljava/lang/String;I)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_addNode\r
+ (JNIEnv *, jobject, jstring, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: deleteNode\r
+ * Signature: (I)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_deleteNode\r
+ (JNIEnv *, jobject, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: moveNode\r
+ * Signature: (II)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_moveNode\r
+ (JNIEnv *, jobject, jint, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: setSelection\r
+ * Signature: ([I)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setSelection\r
+ (JNIEnv *, jobject, jintArray);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: getNodeTransform\r
+ * Signature: (I)[F\r
+ */\r
+JNIEXPORT jfloatArray JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getNodeTransform\r
+ (JNIEnv *, jobject, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: getMeshName\r
+ * Signature: (I)Ljava/lang/String;\r
+ */\r
+JNIEXPORT jstring JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getMeshName\r
+ (JNIEnv *, jobject, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: getMeshMaterial\r
+ * Signature: (I)Ljava/lang/String;\r
+ */\r
+JNIEXPORT jstring JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getMeshMaterial\r
+ (JNIEnv *, jobject, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: setName\r
+ * Signature: (ILjava/lang/String;)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setName\r
+ (JNIEnv *, jobject, jint, jstring);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: setNodePosition\r
+ * Signature: (I[F)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setNodePosition\r
+ (JNIEnv *, jobject, jint, jfloatArray);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: setNodeRotation\r
+ * Signature: (I[F)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setNodeRotation\r
+ (JNIEnv *, jobject, jint, jfloatArray);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: setNodeScale\r
+ * Signature: (I[F)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setNodeScale\r
+ (JNIEnv *, jobject, jint, jfloatArray);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: setMeshName\r
+ * Signature: (ILjava/lang/String;)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setMeshName\r
+ (JNIEnv *, jobject, jint, jstring);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: setMeshMaterial\r
+ * Signature: (ILjava/lang/String;)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setMeshMaterial\r
+ (JNIEnv *, jobject, jint, jstring);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: setGizmoMode\r
+ * Signature: (IZ)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setGizmoMode\r
+ (JNIEnv *, jobject, jint, jboolean);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: getLeafListRef\r
+ * Signature: (I)[I\r
+ */\r
+JNIEXPORT jintArray JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getLeafListRef\r
+ (JNIEnv *, jobject, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: getAttachablesList\r
+ * Signature: (I)[Ljava/lang/String;\r
+ */\r
+JNIEXPORT jobjectArray JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getAttachablesList\r
+ (JNIEnv *, jobject, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: getAttachableProperties\r
+ * Signature: (ILjava/lang/String;)Ljava/lang/Object;\r
+ */\r
+JNIEXPORT jobject JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_getAttachableProperties\r
+ (JNIEnv *, jobject, jint, jstring);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: setAttachableIntProperty\r
+ * Signature: (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;I)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setAttachableIntProperty\r
+ (JNIEnv *, jobject, jint, jstring, jstring, jstring, jint);\r
+\r
+/*\r
+ * Class: org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor\r
+ * Method: setAttachableStringProperty\r
+ * Signature: (ILjava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)V\r
+ */\r
+JNIEXPORT void JNICALL Java_org_tizen_tools_areditor_sceneeditor_editor3d_NativeSceneEditor_setAttachableStringProperty\r
+ (JNIEnv *, jobject, jint, jstring, jstring, jstring, jstring);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+#endif\r
-#include <windows.h>
-#include <UcApplication.h>
-#include <FGrpFloatRectangle.h>
-#include <FGrpBufferInfo.h>
-#include <FUiAnimVisualElement.h>
-#include <FUiAnimVisualElementSurface.h>
-
-using namespace UiCore;
-using namespace Tizen::Graphics;
-using namespace Tizen::Ui::Animations;
-
-Application application;
-const char g_szClassName[] = "myWindowClass";
-
-LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- switch(msg)
- {
- case WM_LBUTTONDOWN:
- {
- VisualElement* pElement = new VisualElement();
- pElement->Construct();
- pElement->SetShowState(true);
- pElement->SetBounds(FloatRectangle(0, 0, 100, 100));
- (application.GetRootVisualElement())->AttachChild(pElement);
-
- VisualElementSurface* pSurface = new VisualElementSurface();
- pSurface->Construct(*application.GetDisplayContext(), FloatDimension(100, 100));
-
- BufferInfo bufferInfo;
- pSurface->GetBufferInfo(bufferInfo);
-
- memset(bufferInfo.pPixels, 0xFF, bufferInfo.width * bufferInfo.height * 4);
- pElement->SetSurface(pSurface);
- }
- break;
-
- case WM_RBUTTONDOWN:
- application.UpdateLayer();
- break;
-
- case WM_CLOSE:
- DestroyWindow(hwnd);
- break;
-
- case WM_DESTROY:
- PostQuitMessage(0);
- break;
-
- default:
- return DefWindowProc(hwnd, msg, wParam, lParam);
- }
-
- return 0;
-}
-
-int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
-{
- WNDCLASSEX wc;
- HWND hwnd;
- MSG Msg;
-
- wc.cbSize = sizeof(WNDCLASSEX);
- wc.style = 0;
- wc.lpfnWndProc = WndProc;
- wc.cbClsExtra = 0;
- wc.cbWndExtra = 0;
- wc.hInstance = hInstance;
- wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);
- wc.hCursor = LoadCursor(NULL, IDC_ARROW);
- wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
- wc.lpszMenuName = NULL;
- wc.lpszClassName = g_szClassName;
- wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);
-
- if(!RegisterClassEx(&wc))
- {
- MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
- }
-
- hwnd = CreateWindowEx(WS_EX_CLIENTEDGE,
- g_szClassName,
- "TestApplication",
- WS_OVERLAPPEDWINDOW,
- CW_USEDEFAULT, CW_USEDEFAULT, 400, 400,
- NULL, NULL, hInstance, NULL);
-
- if(hwnd == NULL)
- {
- MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);
- return 0;
- }
-
- application.CreateLayer((int)hwnd);
-
- ShowWindow(hwnd, nCmdShow);
- UpdateWindow(hwnd);
-
- while(GetMessage(&Msg, NULL, 0, 0) > 0)
- {
- TranslateMessage(&Msg);
- DispatchMessage(&Msg);
- }
-
- return Msg.wParam;
-}
+#include <windows.h>\r
+#include <UcApplication.h>\r
+#include <FGrpFloatRectangle.h>\r
+#include <FGrpBufferInfo.h>\r
+#include <FUiAnimVisualElement.h>\r
+#include <FUiAnimVisualElementSurface.h>\r
+#include <FUiAnimMesh.h>\r
+#include <FUiAnimShaderProgram.h>\r
+#include <FGrpColor.h>\r
+#include <FUiAnimModelImporter.h>\r
+//#include <FUiAnimCamera.h>\r
+#include <FGrpFloatMatrix4.h>\r
+\r
+\r
+using namespace UiCore;\r
+using namespace Tizen::Graphics;\r
+using namespace Tizen::Ui::Animations;\r
+using namespace Tizen::Base;\r
+using namespace Tizen::Base::Collection;\r
+using namespace Tizen::Media;\r
+\r
+static Application application;\r
+const char g_szClassName[] = "myWindowClass";\r
+\r
+static const char strVertexShader_texture[] =\r
+ "uniform mat4 u_mvp;\n"\r
+ //"uniform mat4 u_inv_mvp;\n"\r
+ "attribute vec4 a_position;\n"\r
+ "attribute vec4 a_normal;\n"\r
+ "varying vec4 v_normal;\n"\r
+ "void main()\n"\r
+ "{\n"\r
+ " v_normal = a_normal;"\r
+ " gl_Position = u_mvp * a_position;\n"\r
+// " gl_Position = a_position;\n"\r
+ "}\n";\r
+\r
+static const char strFragmentShader_texture[] =\r
+ "precision highp float;\n"\r
+ "varying vec4 v_normal;\n"\r
+ "void main()\n"\r
+ "{\n" \r
+ " gl_FragColor = vec4(0.5, 0.5, 0.5, 1) * max( dot(vec4(0, 0, 0, 1), normalize(v_normal)) , 0.0);\n"\r
+// " gl_FragColor = vec4(1., 0., 0., 1);\n"\r
+ "}\n";\r
+ \r
+\r
+LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)\r
+{\r
+// String testStr(L"Hello Tizen");\r
+// ArrayListT<String> arr;\r
+ \r
+// {\r
+ \r
+ //arr.Add(testStr);\r
+// testStr = String(L"Go_Go_");\r
+// }\r
+// String answer;\r
+// printf("\nbefore copy %i str=%S endl\n", testStr.GetLength(), testStr.GetPointer());\r
+// printf("\n");\r
+// arr.GetAt(0, answer);\r
+ \r
+// printf("answer=%S\n", answer.GetPointer());\r
+ \r
+ switch(msg)\r
+ {\r
+ case WM_LBUTTONDOWN:\r
+ {\r
+ FloatRectangle clientRect = application.GetLayerBounds();\r
+ application.GetRootVisualElement()->SetShowState(true);\r
+ application.GetRootVisualElement()->SetOpacity(1.0f);\r
+ \r
+// Tizen::Ui::Animations::Camera* __pCamera = new Tizen::Ui::Animations::Camera();\r
+// __pCamera->SetPerspective(60.0 ,0.01, 400);\r
+// __pCamera->LookAt(Tizen::Graphics::FloatPoint3(0,0,50), Tizen::Graphics::FloatPoint3(0,0,0),Tizen::Graphics::FloatPoint3(0,1,0));\r
+\r
+ \r
+// VisualElement* pCameraVE = new (std::nothrow) VisualElement();\r
+// pCameraVE->Construct();\r
+// pCameraVE->SetName(L"CameraVE");\r
+// pCameraVE->SetShowState(true);\r
+// pCameraVE->SetImplicitAnimationEnabled(false);\r
+// pCameraVE->SetChildrenTransformMatrix(__pCamera->GetMatrix());\r
+// application.GetRootVisualElement()->AttachChild(pCameraVE);\r
+ \r
+ VisualElement* pElement = new VisualElement();\r
+ pElement->Construct();\r
+ pElement->SetShowState(true);\r
+ pElement->SetOpacity(1.0f);\r
+ //pElement->SetBounds(FloatRectangle(1, 1, 0.f, 0.f));\r
+ pElement->SetBounds(FloatRectangle(clientRect.width / 2, clientRect.height / 2, 100, 100));\r
+ pElement->SetImplicitAnimationEnabled(false);\r
+// pCameraVE->AttachChild(pElement);\r
+// application.GetRootVisualElement()->AttachChild(pElement);\r
+\r
+ // VisualElementSurface* pSurface = new VisualElementSurface();\r
+ // pSurface->Construct(*application.GetDisplayContext(), FloatDimension(100, 100));\r
+\r
+ // BufferInfo bufferInfo;\r
+ // pSurface->GetBufferInfo(bufferInfo);\r
+\r
+ // memset(bufferInfo.pPixels, 0xFF, bufferInfo.width * bufferInfo.height * 4);\r
+ //pElement->SetSurface(pSurface);\r
+// pElement->SetSurface(LoadTextureInSurface("scorpio_UV.png"));\r
+ \r
+// Mesh* pMesh = ModelImporter::LoadMeshN(ModelImporter::COLLADA, "scorpion_.DAE", "", true);\r
+ Mesh* pMesh = ModelImporter::LoadMeshN(ModelImporter::COLLADA, "scorpion_.DAE", "");\r
+// Mesh* pMesh = ModelImporter::LoadMeshN(ModelImporter::COLLADA, "lizard_animation_1.DAE", "");\r
+ \r
+ Mesh* pTriangleMesh = new (std::nothrow) Mesh();\r
+ pTriangleMesh->SetGeometryType(Mesh::GEO_TYPE_TRIANGLES);\r
+\r
+ FloatRectangle rect(0,0,500,500);// = pElement->GetBounds();\r
+ pTriangleMesh->ReserveVertices(4);\r
+ pTriangleMesh->SetVertex(0, FloatPoint3(rect.x, rect.y, -100.));\r
+ pTriangleMesh->SetVertex(1, FloatPoint3(rect.x, rect.y + rect.height, -100.0));\r
+ pTriangleMesh->SetVertex(2, FloatPoint3(rect.x + rect.width, rect.y, -100.0));\r
+ pTriangleMesh->SetVertex(3, FloatPoint3(rect.x + rect.width, rect.y + rect.height, -100.0));\r
+\r
+ pTriangleMesh->ReserveIndices(6);\r
+ pTriangleMesh->SetIndex(0, 0);\r
+ pTriangleMesh->SetIndex(1, 1);\r
+ pTriangleMesh->SetIndex(2, 2);\r
+ pTriangleMesh->SetIndex(3, 1);\r
+ pTriangleMesh->SetIndex(4, 3);\r
+ pTriangleMesh->SetIndex(5, 2);\r
+\r
+ pTriangleMesh->ReserveTextureCoordinates();\r
+ pTriangleMesh->SetTextureCoord(0,FloatPoint(0,0));\r
+ pTriangleMesh->SetTextureCoord(1,FloatPoint(0,1));\r
+ pTriangleMesh->SetTextureCoord(2,FloatPoint(1,0));\r
+ pTriangleMesh->SetTextureCoord(3,FloatPoint(1,1));\r
+\r
+ \r
+ pTriangleMesh->ReserveColors();\r
+ pTriangleMesh->SetColor(0, Color(255, 0, 0, 255));\r
+ pTriangleMesh->SetColor(1, Color(0, 255, 0, 255));\r
+ pTriangleMesh->SetColor(2, Color(0, 0, 255, 255));\r
+ pTriangleMesh->SetColor(2, Color(0, 255, 255, 255));\r
+\r
+ \r
+ pTriangleMesh->ReserveNormals();\r
+ pTriangleMesh->SetNormal(0, FloatPoint3(0., 0., 1.));\r
+ pTriangleMesh->SetNormal(1, FloatPoint3(0., 0., 1.));\r
+ pTriangleMesh->SetNormal(2, FloatPoint3(0., 0., 1.));\r
+ pTriangleMesh->SetNormal(3, FloatPoint3(0., 0., 1.));\r
+ \r
+ VisualElement* pTringleVE = new VisualElement();\r
+ pTringleVE->Construct();\r
+ pTringleVE->SetShowState(true);\r
+ pTringleVE->SetOpacity(1.0f);\r
+// pTringleVE->SetBounds(FloatRectangle(100, 150, 0.f, 0.f));\r
+ pTringleVE->SetBounds(FloatRectangle(0, 0, 1, 1));\r
+ //pTringleVE->SetBounds(FloatRectangle(clientRect.width / 2, clientRect.height / 2, 100, 100));\r
+ pTringleVE->SetImplicitAnimationEnabled(false);\r
+// pCameraVE->AttachChild(pElement);\r
+ pTringleVE->AttachChild(pElement);\r
+ application.GetRootVisualElement()->AttachChild(pTringleVE);\r
+ \r
+ \r
+ ShaderProgram* __pShader = new ShaderProgram();\r
+ Shader vert;\r
+ vert.Construct(Shader::SHADER_VERTEX,strVertexShader_texture);\r
+ Shader frag;\r
+ frag.Construct(Shader::SHADER_FRAGMENT,strFragmentShader_texture);\r
+ __pShader->Construct(vert, frag);\r
+ \r
+ pElement->SetMesh(pMesh);\r
+ //__pShader->SetUniform("u_mvps", __pCamera->GetMatrix());\r
+ pElement->SetShaderProgram(__pShader);\r
+\r
+ pTringleVE->SetMesh(pTriangleMesh);\r
+ pTringleVE->SetShaderProgram(__pShader);\r
+\r
+ \r
+ float scale = 1.f;\r
+ pElement->SetProperty(L"transform.scale.x", scale);\r
+ pElement->SetProperty(L"transform.scale.y", scale);\r
+ pElement->SetProperty(L"transform.scale.z", scale);\r
+ \r
+ float x = 230;\r
+ float y = 100;\r
+ //pElement->SetProperty(L"transform.translation.x", x);\r
+// pElement->SetProperty(L"transform.translation.y", y);\r
+// pElement->SetProperty(L"transform.scale.z", scale);\r
+ \r
+ printf("x=%f, y=%f\n", pElement->GetBounds().x, pElement->GetBounds().y);\r
+ }\r
+ break;\r
+\r
+ case WM_RBUTTONDOWN:\r
+ application.UpdateLayer();\r
+ break;\r
+\r
+ case WM_CLOSE:\r
+ DestroyWindow(hwnd);\r
+ break;\r
+\r
+ case WM_DESTROY:\r
+ PostQuitMessage(0);\r
+ break;\r
+\r
+ default:\r
+ return DefWindowProc(hwnd, msg, wParam, lParam);\r
+ }\r
+\r
+ return 0;\r
+}\r
+\r
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)\r
+{\r
+ WNDCLASSEX wc;\r
+ HWND hwnd;\r
+ MSG Msg;\r
+\r
+ wc.cbSize = sizeof(WNDCLASSEX);\r
+ wc.style = 0;\r
+ wc.lpfnWndProc = WndProc;\r
+ wc.cbClsExtra = 0;\r
+ wc.cbWndExtra = 0;\r
+ wc.hInstance = hInstance;\r
+ wc.hIcon = LoadIcon(NULL, IDI_APPLICATION);\r
+ wc.hCursor = LoadCursor(NULL, IDC_ARROW);\r
+ wc.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);\r
+ wc.lpszMenuName = NULL;\r
+ wc.lpszClassName = g_szClassName;\r
+ wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION);\r
+\r
+ if(!RegisterClassEx(&wc))\r
+ {\r
+ MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);\r
+ return 0;\r
+ }\r
+\r
+ hwnd = CreateWindowEx(WS_EX_CLIENTEDGE,\r
+ g_szClassName,\r
+ "TestApplication",\r
+ WS_OVERLAPPEDWINDOW,\r
+ 100, 100, 500, 500,\r
+ NULL, NULL, hInstance, NULL);\r
+\r
+ if(hwnd == NULL)\r
+ {\r
+ MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK);\r
+ return 0;\r
+ }\r
+\r
+ application.CreateLayer((int)hwnd);\r
+\r
+ ShowWindow(hwnd, nCmdShow);\r
+ UpdateWindow(hwnd);\r
+\r
+ while(GetMessage(&Msg, NULL, 0, 0) > 0)\r
+ {\r
+ TranslateMessage(&Msg);\r
+ DispatchMessage(&Msg);\r
+ }\r
+\r
+ return Msg.wParam;\r
+}\r
void UpdateLayer(void);
void SetLayerSize(const Tizen::Graphics::FloatDimension& dimension);
void SetLayerBounds(const Tizen::Graphics::FloatRectangle& bounds);
+ Tizen::Graphics::FloatRectangle GetLayerBounds(void);
Tizen::Ui::Animations::VisualElement* GetRootVisualElement(void) const;
const Tizen::Ui::Animations::DisplayContext* GetDisplayContext(void) const;
${UIFW_DIRECTORY}/src/ui/animations
${UIFW_DIRECTORY}/src/ui/animations/platform
${UIFW_DIRECTORY}/src/ui/animations/math
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada
${RSA_DEV_DIRECTORY}/external/boost
/usr/include/cairo
/usr/include/pixman-1
)
ELSEIF(_WIN32)
INCLUDE_DIRECTORIES(
+
+ ${UIFW_DIRECTORY}/src/ui-core/src/inc
+ ${UIFW_DIRECTORY}/src/ui-core/src/ui/inc
+ ${UIFW_DIRECTORY}/src/ui-core/src/media/osp-image/inc
+ ${UIFW_DIRECTORY}/src/ui-core/src/media/osp-image/src/inc
+ ${UIFW_DIRECTORY}/src/ui-core/src/media/osp-image-core/inc
+ ${UIFW_DIRECTORY}/src/ui-core/src/media/osp-image-core/src/inc
+
+
../inc
../inc/mesa
base/inc
base/inc/runtime
graphics
graphics/inc
- ${UIFW_DIRECTORY}/src/ui-core/inc
+
+
${UIFW_DIRECTORY}/inc
${UIFW_DIRECTORY}/src/ui/inc
${UIFW_DIRECTORY}/src/ui/animations
${UIFW_DIRECTORY}/src/ui/animations/platform
+ ${UIFW_DIRECTORY}/src/ui/animations/math
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada
+ ${UIFW_DIRECTORY}/../osp-appfw/inc
${RSA_DEV_DIRECTORY}/external/boost
+ ${RSA_DEV_DIRECTORY}/external/icu/include
+ ${RSA_DEV_DIRECTORY}/external/libxml2/src/include
../inc/cairo
../inc/pixman-1
+ ${UIFW_DIRECTORY}/src/ui-core/example/Plugin
)
ENDIF(LINUX)
SET(${this_target}_SOURCE_FILES
UcApplication.cpp
+ ../example/Plugin/j_utils.cpp
base/FBaseObject.cpp
base/FBaseResult.cpp
base/FBaseErrors.cpp
base/FBaseString.cpp
base/FBaseStringComparer.cpp
base/FBaseStringHashCodeProvider.cpp
+ base/FBaseInteger.cpp
+ base/FBaseLong.cpp
+ base/FBaseLongLong.cpp
+ base/FBaseShort.cpp
base/FBaseSysLog.cpp
base/FBaseDateTime.cpp
base/FBaseTimeSpan.cpp
base/FBaseDouble.cpp
base/FBaseFloat.cpp
base/FBase_StringConverter.cpp
-# base/utility/FBaseUtil_IcuConverter.cpp
+ base/utility/FBaseUtil_IcuConverter.cpp
base/runtime/FBaseRtIEventListener.cpp
base/collection/FBaseColMapEntry.cpp
base/collection/FBaseColQueue.cpp
graphics/effect/FGrp_EffectRotate.cpp
graphics/effect/FGrp_EffectScale.cpp
graphics/effect/FGrp_EffectScale2.cpp
+ ui/animations/FUiAnim_DynamicProperty.cpp
${UIFW_DIRECTORY}/src/ui/animations/platform/FUiAnim_NativeWindow.cpp
${UIFW_DIRECTORY}/src/ui/animations/platform/FUiAnim_GlContext.cpp
${UIFW_DIRECTORY}/src/ui/animations/platform/FUiAnim_Egl.cpp
${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_GlLoader.cpp
${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_GlNode.cpp
${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_GlRenderManager.cpp
- ${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_GlShaderProgram.cpp
${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.cpp
${UIFW_DIRECTORY}/src/ui/animations/FUiAnimShaderProgram.cpp
${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_ShaderProgramImpl.cpp
${UIFW_DIRECTORY}/src/ui/animations/math/FUiAnim_MathVector2.cpp
${UIFW_DIRECTORY}/src/ui/animations/math/FUiAnim_MathVector3.cpp
${UIFW_DIRECTORY}/src/ui/animations/math/FUiAnim_MathVector4.cpp
- ${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_GlDefaultShaderProgram.cpp
- ${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_DynamicProperty.cpp
# ${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_CustomShader.cpp
${UIFW_DIRECTORY}/src/ui/animations/FUiAnimBoundingVolume.cpp
${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_BoundingVolumeImpl.cpp
${UIFW_DIRECTORY}/src/ui/animations/FUiAnimMaterial.cpp
${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_LightImpl.cpp
${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_MaterialImpl.cpp
-
+ ${UIFW_DIRECTORY}/src/ui/animations/FUiAnimModelImporter.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_ModelImporterImpl.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_MeshController.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_Plane.cpp
+
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-images/FUiAnim_ImportColladaLibImgLibraryImages.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-images/FUiAnim_ImportColladaLibImgImage.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-animations/FUiAnim_ImportColladaLibAnimAnimation.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-animations/FUiAnim_ImportColladaLibAnimLibraryAnimations.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-animations/FUiAnim_ImportColladaLibAnimChannel.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-materials/FUiAnim_ImportColladaLibMatLibraryMaterials.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-materials/FUiAnim_ImportColladaLibMatMaterial.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-geometries/FUiAnim_ImportColladaLibGeomGeometry.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-geometries/FUiAnim_ImportColladaLibGeomLibraryGeometries.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-geometries/FUiAnim_ImportColladaLibGeomGeometryMesh.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/FUiAnim_ImportColladaTools.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-effects/FUiAnim_ImportColladaLibEffNewParam.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-effects/FUiAnim_ImportColladaLibEffProfile.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-effects/FUiAnim_ImportColladaLibEffCommonShaderData.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-effects/FUiAnim_ImportColladaLibEffEffect.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-effects/FUiAnim_ImportColladaLibEffLibraryEffects.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-effects/FUiAnim_ImportColladaLibEffParam.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-visual-scenes/FUiAnim_ImportColladaLibVisScenVisualScene.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-visual-scenes/FUiAnim_ImportColladaLibVisScenInstanceGeometry.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-visual-scenes/FUiAnim_ImportColladaLibVisScenTranslate.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-visual-scenes/FUiAnim_ImportColladaLibVisScenMatrix.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-visual-scenes/FUiAnim_ImportColladaLibVisScenInstance.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-visual-scenes/FUiAnim_ImportColladaLibVisScenScale.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-visual-scenes/FUiAnim_ImportColladaLibVisScenRotate.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-visual-scenes/FUiAnim_ImportColladaLibVisScenTransform.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-visual-scenes/FUiAnim_ImportColladaLibVisScenInstanceController.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-visual-scenes/FUiAnim_ImportColladaLibVisScenNode.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-visual-scenes/FUiAnim_ImportColladaLibVisScenBindMaterial.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-visual-scenes/FUiAnim_ImportColladaLibVisScenLibraryVisualScenes.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-lights/FUiAnim_ImportColladaLibLigPoint.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-lights/FUiAnim_ImportColladaLibLigLibraryLights.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-lights/FUiAnim_ImportColladaLibLigLightWithAttenuation.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-lights/FUiAnim_ImportColladaLibLigLight.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-lights/FUiAnim_ImportColladaLibLigSpot.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-controllers/FUiAnim_ImportColladaLibContControllerSkin.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-controllers/FUiAnim_ImportColladaLibContController.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-controllers/FUiAnim_ImportColladaLibContLibraryControllers.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/FUiAnim_ImportColladaColladaAssets.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-cameras/FUiAnim_ImportColladaLibCamLibraryCameras.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/import-collada/library-cameras/FUiAnim_ImportColladaLibCamCamera.cpp
+
+ ${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_SceneImpl.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/FUiAnimScene.cpp
+ ${UIFW_DIRECTORY}/src/ui/animations/FUiAnimMeshController.cpp
+# ${UIFW_DIRECTORY}/src/ui/animations/FUiAnimCamera.cpp
+# ${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_CameraImpl.cpp
${UIFW_DIRECTORY}/src/ui/FUi_Matrix3Df.cpp
${UIFW_DIRECTORY}/src/ui/FUi_PropertyBase.cpp
${UIFW_DIRECTORY}/src/ui/FUi_PropertyUtils.cpp
${UIFW_DIRECTORY}/src/ui/FUi_VariantImpl.cpp
${UIFW_DIRECTORY}/src/ui/FUiVariant.cpp
+
)
IF(LINUX)
TARGET_LINK_LIBRARIES(${this_target} "-llibEGL" )
TARGET_LINK_LIBRARIES(${this_target} "-lpixman-1_win" )
TARGET_LINK_LIBRARIES(${this_target} "-lcairo-2" )
+TARGET_LINK_LIBRARIES(${this_target} "-licuuc" )
+TARGET_LINK_LIBRARIES(${this_target} "-llibxml2" )
ENDIF(LINUX)
-#include <UcApplication.h>
-#include <FUiAnimVisualElement.h>
-#include <FUiAnimDisplayContext.h>
-#include <FGrpFloatDimension.h>
-#include <FGrpFloatRectangle.h>
-
-#include "FUiAnim_AnimationManager.h"
-#include "FUiAnim_DisplayManager.h"
-#include "FUiAnim_DisplayContextImpl.h"
-#include "FUiAnim_Looper.h"
-#include "FUiAnim_NativeLayer.h"
-#include "FUiAnim_RootVisualElement.h"
-#ifdef _WIN32
-#include "FUiAnim_GlLayer.h"
-#include "FUiAnim_Win32Window.h"
-#endif
-
-using namespace Tizen::Graphics;
-using namespace Tizen::Ui::Animations;
-
-namespace UiCore {
-
-Application::Application(void)
- : __pNativeLayer(null)
-#ifdef _WIN32
- , __pWindow(null)
-#endif
-{
- _AnimationManager::CreateInstance();
- _DisplayManager::CreateInstance();
-}
-
-Application::~Application(void)
-{
- delete __pNativeLayer;
- __pNativeLayer = null;
-
-#ifdef _WIN32
- delete __pWindow;
- __pWindow = null;
-#endif
-}
-
-void
-Application::CreateLayer(int windowHandle)
-{
-#ifdef LINUX
- __pNativeLayer = _NativeLayer::CreateInstanceN();
-#elif _WIN32
- __pWindow = new _Win32Window(windowHandle);
- __pNativeLayer = new _GlLayer();
- __pNativeLayer->Construct(__pWindow);
-#endif
-
- __pNativeLayer->SetBounds(FloatRectangle(100,100,500,500));
-
- __pNativeLayer->SetShowState(true);
-}
-
-void
-Application::UpdateLayer(void)
-{
- _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
- if (pDisplayManager)
- {
- pDisplayManager->RenderAll(true);
- __pNativeLayer->Flush();
- }
-}
-
-void
-Application::SetLayerSize(const FloatDimension& dimension)
-{
- __pNativeLayer->SetBounds(FloatRectangle(__pNativeLayer->GetBounds().x, __pNativeLayer->GetBounds().y, dimension.width, dimension.height));
-}
-
-void
-Application::SetLayerBounds(const FloatRectangle& bounds)
-{
- __pNativeLayer->SetBounds(bounds);
-}
-
-VisualElement*
-Application::GetRootVisualElement(void) const
-{
- return __pNativeLayer->GetRootVisualElement();
-}
-
-const DisplayContext*
-Application::GetDisplayContext(void) const
-{
- return _DisplayContextImpl::CreatePublicInstance(*__pNativeLayer);
-}
-
-void
-Application::IterateMainLoop(void)
-{
-#ifdef LINUX
- _Looper* pLooper = _Looper::GetInstance();
-
- _RawEvent rawEvent;
-
- if(pLooper->GetRawEvent(rawEvent, -1) != 0)
- {
- pLooper->DispatchRawEvent(rawEvent);
- printf("OnMainLoop:event(%d) \n",rawEvent.type);
- }
-#endif
-}
-
-} // UiCore
+#include <UcApplication.h>\r
+#include <FUiAnimVisualElement.h>\r
+#include <FUiAnimDisplayContext.h>\r
+#include <FGrpFloatDimension.h>\r
+#include <FGrpFloatRectangle.h>\r
+\r
+#include "FUiAnim_AnimationManager.h"\r
+#include "FUiAnim_DisplayManager.h"\r
+#include "FUiAnim_DisplayContextImpl.h"\r
+#include "FUiAnim_Looper.h"\r
+#include "FUiAnim_NativeLayer.h"\r
+#include "FUiAnim_RootVisualElement.h"\r
+#ifdef _WIN32\r
+#include "FUiAnim_GlLayer.h"\r
+#include "FUiAnim_Win32Window.h"\r
+#endif\r
+\r
+using namespace Tizen::Graphics;\r
+using namespace Tizen::Ui::Animations;\r
+\r
+namespace UiCore {\r
+\r
+Application::Application(void)\r
+ : __pNativeLayer(null)\r
+#ifdef _WIN32\r
+ , __pWindow(null)\r
+#endif\r
+{\r
+ _AnimationManager::CreateInstance();\r
+ _DisplayManager::CreateInstance();\r
+}\r
+\r
+Application::~Application(void)\r
+{\r
+ delete __pNativeLayer;\r
+ __pNativeLayer = null;\r
+\r
+#ifdef _WIN32\r
+ delete __pWindow;\r
+ __pWindow = null;\r
+#endif\r
+}\r
+\r
+void\r
+Application::CreateLayer(int windowHandle)\r
+{\r
+#ifdef LINUX\r
+ __pNativeLayer = _NativeLayer::CreateInstanceN();\r
+#elif _WIN32\r
+ __pWindow = new _Win32Window(windowHandle);\r
+ __pNativeLayer = new _GlLayer();\r
+// __pNativeLayer->Construct(__pWindow);\r
+ __pNativeLayer->Construct(__pWindow);\r
+#endif\r
+\r
+ __pNativeLayer->SetBounds(FloatRectangle(100,100,500,500));\r
+ __pNativeLayer->SetShowState(true);\r
+}\r
+\r
+void\r
+Application::UpdateLayer(void)\r
+{\r
+ _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();\r
+ if (pDisplayManager)\r
+ {\r
+ pDisplayManager->RenderAll(true);\r
+ __pNativeLayer->Flush();\r
+ }\r
+}\r
+\r
+void\r
+Application::SetLayerSize(const FloatDimension& dimension)\r
+{\r
+ __pNativeLayer->SetBounds(FloatRectangle(__pNativeLayer->GetBounds().x, __pNativeLayer->GetBounds().y, dimension.width, dimension.height));\r
+}\r
+\r
+void\r
+Application::SetLayerBounds(const FloatRectangle& bounds)\r
+{\r
+ __pNativeLayer->SetBounds(bounds);\r
+}\r
+\r
+VisualElement*\r
+Application::GetRootVisualElement(void) const\r
+{\r
+ return __pNativeLayer->GetRootVisualElement();\r
+}\r
+\r
+const DisplayContext*\r
+Application::GetDisplayContext(void) const\r
+{\r
+ return _DisplayContextImpl::CreatePublicInstance(*__pNativeLayer);\r
+}\r
+\r
+void\r
+Application::IterateMainLoop(void)\r
+{\r
+#ifdef LINUX\r
+ _Looper* pLooper = _Looper::GetInstance();\r
+\r
+ _RawEvent rawEvent;\r
+\r
+ if(pLooper->GetRawEvent(rawEvent, -1) != 0)\r
+ {\r
+ pLooper->DispatchRawEvent(rawEvent);\r
+ printf("OnMainLoop:event(%d) \n",rawEvent.type);\r
+ }\r
+#endif\r
+}\r
+\r
+Tizen::Graphics::FloatRectangle \r
+Application::GetLayerBounds(void)\r
+{\r
+ return __pNativeLayer->GetBounds();\r
+}\r
+\r
+} // UiCore\r
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseInteger.cpp
+ * @brief This is the implementation file for Integer class.
+ * @see Number
+ */
+
+#include <wchar.h>
+#include <limits.h>
+#include <errno.h>
+#include <FBaseInteger.h>
+#include <FBaseResult.h>
+#include <FBaseCharacter.h>
+#include <FBaseSysLog.h>
+
+namespace Tizen { namespace Base
+{
+
+Integer::Integer(int value)
+ : value(value)
+ , __pIntegerImpl(null)
+{
+}
+
+Integer::Integer(const Integer& value)
+ : value(value.value)
+ , __pIntegerImpl(null)
+{
+}
+
+Integer::~Integer(void)
+{
+
+}
+
+Integer&
+Integer::operator =(const Integer& rhs)
+{
+ if (&rhs != this)
+ {
+ value = rhs.value;
+ }
+ return *this;
+}
+
+int
+Integer::Compare(int i1, int i2)
+{
+ return(i1 < i2 ? -1 : (i1 == i2 ? 0 : 1));
+}
+
+int
+Integer::CompareTo(const Integer& value) const
+{
+ return(Integer::Compare(this->value, value.value));
+}
+
+bool
+Integer::Equals(const Object& obj) const
+{
+ const Integer* pOther = dynamic_cast <const Integer*>(&obj);
+ if (pOther == null)
+ {
+ return false;
+ }
+
+ return value == (*pOther).value;
+}
+
+result
+Integer::Decode(const String& s, int& ret)
+{
+ SysTryReturn(NID_BASE, s.GetLength() >= 1, E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] The length of s MUST be greater than 0.", GetErrorMessage(E_NUM_FORMAT));
+
+ int radix = 0;
+ wchar_t* pEnd = null;
+ String str(s);
+
+ // Find radix
+ if (s[0] == L'#')
+ {
+ radix = Character::RADIX_HEXADECIMAL;
+
+ // Remove '#'
+ str.Remove(0, 1);
+ }
+ else if (s[0] == L'0' && (s.GetLength() >= 2))
+ {
+ if (s[1] == L'x' || s[1] == L'X')
+ {
+ radix = Character::RADIX_HEXADECIMAL;
+ }
+ else
+ {
+ radix = Character::RADIX_OCTAL;
+ }
+ }
+ else
+ {
+ radix = Character::RADIX_DECIMAL;
+ }
+
+ errno = 0;
+ ret = wcstol(str.GetPointer(), &pEnd, radix);
+ SysTryReturn(NID_BASE, (pEnd[0] == 0), E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] Integer decode failed. Scan stopped at (%ls).", GetErrorMessage(E_NUM_FORMAT), pEnd);
+ SysTryReturn(NID_BASE, !((ret == LONG_MAX || ret == LONG_MIN) && (errno != 0)), E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] Decoded value cannot fit into an Integer.", GetErrorMessage(E_NUM_FORMAT));
+
+ return E_SUCCESS;
+}
+
+int
+Integer::GetHashCode(void) const
+{
+ return value;
+}
+
+int
+Integer::GetHashCode(int val)
+{
+ return val;
+}
+
+result
+Integer::Parse(const String& s, int& ret)
+{
+ int len = s.GetLength();
+ SysTryReturn(NID_BASE, (len > 0 && len < 12), E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] The length of s(%ls) MUST be greater than 0 and less than 12.",
+ GetErrorMessage(E_NUM_FORMAT), s.GetPointer());
+
+ return Parse(s, Character::RADIX_DECIMAL, ret);
+}
+
+result
+Integer::Parse(const String& s, int radix, int& ret)
+{
+ SysTryReturn(NID_BASE, ((radix == Character::RADIX_BINARY) || (radix == Character::RADIX_OCTAL) ||
+ (radix == Character::RADIX_DECIMAL) || (radix == Character::RADIX_HEXADECIMAL)), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
+ "[%s] The radix(%d) MUST be one of 2, 8, 10 and 16.", GetErrorMessage(E_OUT_OF_RANGE), radix);
+
+ int len = s.GetLength();
+ SysTryReturn(NID_BASE, (len > 0), E_NUM_FORMAT, E_NUM_FORMAT, "[%s] The length of s MUST be greater than 0.",
+ GetErrorMessage(E_NUM_FORMAT));
+
+ errno = 0;
+ wchar_t* pEnd = null;
+ int tmpRet = wcstol(s.GetPointer(), &pEnd, radix);
+ SysTryReturn(NID_BASE, (pEnd[0] == 0), E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] Integer parse failed. Scan stopped at (%ls).", GetErrorMessage(E_NUM_FORMAT), pEnd);
+ SysTryReturn(NID_BASE, !((tmpRet == LONG_MAX || tmpRet == LONG_MIN) && (errno != 0)), E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] Parsed value cannot fit into an Integer.", GetErrorMessage(E_NUM_FORMAT));
+
+ ret = tmpRet;
+ return E_SUCCESS;
+}
+
+char
+Integer::ToChar(void) const
+{
+ return static_cast<char> (value);
+}
+
+short
+Integer::ToShort(void) const
+{
+ return static_cast<short> (value);
+}
+
+int
+Integer::ToInt(void) const
+{
+ return value;
+}
+
+long
+Integer::ToLong(void) const
+{
+ return static_cast<long> (value);
+}
+
+long long
+Integer::ToLongLong(void) const
+{
+ return static_cast<long long> (value);
+}
+
+float
+Integer::ToFloat(void) const
+{
+ return static_cast<float> (value);
+}
+
+double
+Integer::ToDouble(void) const
+{
+ return static_cast<double> (value);
+}
+
+String
+Integer::ToString(void) const
+{
+ return(Integer::ToString(value));
+}
+
+String
+Integer::ToString(int value)
+{
+ const static unsigned int INTEGER_LENGTH_MAX = 11;
+
+ wchar_t sValue[INTEGER_LENGTH_MAX + 1] = {0, };
+//UI_CORE
+// swprintf(sValue, (sizeof(sValue) / sizeof(sValue[0])), L"%d", value);
+ swprintf(sValue, L"%d", value);
+
+ return String(sValue);
+}
+
+}} //Tizen::Base
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseLong.cpp
+ * @brief This is the implementation file for Long class.
+ * @see Number
+ */
+
+#include <wchar.h>
+#include <limits.h>
+#include <errno.h>
+#include <FBaseLong.h>
+#include <FBaseResult.h>
+#include <FBaseCharacter.h>
+#include <FBaseSysLog.h>
+
+namespace Tizen { namespace Base
+{
+
+Long::Long(long value)
+ : value(value)
+ , __pLongImpl(null)
+{
+}
+
+Long::Long(const Long& value)
+ : value(value.value)
+ , __pLongImpl(null)
+{
+}
+
+Long::~Long(void)
+{
+}
+
+Long&
+Long::operator =(const Long& rhs)
+{
+ if (&rhs != this)
+ {
+ value = rhs.value;
+ }
+ return *this;
+}
+
+int
+Long::Compare(long l1, long l2)
+{
+ return(l1 < l2 ? -1 : (l1 == l2 ? 0 : 1));
+}
+
+int
+Long::CompareTo(const Long& value) const
+{
+ return(Long::Compare(this->value, value.value));
+}
+
+bool
+Long::Equals(const Object& obj) const
+{
+ const Long* pOther = dynamic_cast <const Long*>(&obj);
+ if (pOther == null)
+ {
+ return false;
+ }
+
+ return value == (*pOther).value;
+}
+
+int
+Long::GetHashCode(void) const
+{
+ return static_cast<int> (value);
+}
+
+int
+Long::GetHashCode(long val)
+{
+ return static_cast<int> (val);
+}
+
+result
+Long::Decode(const String& s, long& ret)
+{
+ SysTryReturn(NID_BASE, s.GetLength() >= 1, E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] The length of s MUST be greater than 0.", GetErrorMessage(E_NUM_FORMAT));
+
+ int radix = 0;
+ wchar_t* pEnd = null;
+ String str(s);
+
+ // Find radix
+ if (s[0] == L'#')
+ {
+ radix = Character::RADIX_HEXADECIMAL;
+
+ // Remove '#'
+ str.Remove(0, 1);
+ }
+ else if (s[0] == L'0' && (s.GetLength() >= 2))
+ {
+ if (s[1] == L'x' || s[1] == L'X')
+ {
+ radix = Character::RADIX_HEXADECIMAL;
+ }
+ else
+ {
+ radix = Character::RADIX_OCTAL;
+ }
+ }
+ else
+ {
+ radix = Character::RADIX_DECIMAL;
+ }
+
+ errno = 0;
+ ret = wcstol(str.GetPointer(), &pEnd, radix);
+ SysTryReturn(NID_BASE, (pEnd[0] == 0), E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] Long decode failed. Scan stopped at (%ls).", GetErrorMessage(E_NUM_FORMAT), pEnd);
+ SysTryReturn(NID_BASE, !((ret == LONG_MAX || ret == LONG_MIN) && (errno != 0)), E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] Decoded value cannot fit into a Long.", GetErrorMessage(E_NUM_FORMAT));
+
+ return E_SUCCESS;
+}
+
+result
+Long::Parse(const String& s, long& ret)
+{
+ int len = s.GetLength();
+ SysTryReturn(NID_BASE, (len > 0 && len < 12), E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] The length of s(%ls) MUST be greater than 0 and less than 12.", GetErrorMessage(E_NUM_FORMAT), s.GetPointer());
+
+ return Parse(s, Character::RADIX_DECIMAL, ret);
+}
+
+result
+Long::Parse(const String& s, int radix, long& ret)
+{
+ SysTryReturn(NID_BASE, ((radix == Character::RADIX_BINARY) || (radix == Character::RADIX_OCTAL) ||
+ (radix == Character::RADIX_DECIMAL) || (radix == Character::RADIX_HEXADECIMAL)), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
+ "[%s] The radix(%d) MUST be one of 2, 8, 10 and 16.", GetErrorMessage(E_OUT_OF_RANGE), radix);
+
+ int len = s.GetLength();
+ SysTryReturn(NID_BASE, (len > 0), E_NUM_FORMAT, E_NUM_FORMAT, "[%s] The length of s MUST be greater than 0.",
+ GetErrorMessage(E_NUM_FORMAT));
+
+ errno = 0;
+ wchar_t* pEnd = null;
+ long tmpRet = wcstol(s.GetPointer(), &pEnd, radix);
+ SysTryReturn(NID_BASE, (pEnd[0] == 0), E_NUM_FORMAT, E_NUM_FORMAT, "[%s] Long parse failed. Scan stopped at (%ls).",
+ GetErrorMessage(E_NUM_FORMAT), pEnd);
+ SysTryReturn(NID_BASE, !((tmpRet == LONG_MAX || tmpRet == LONG_MIN) && (errno != 0)), E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] Parsed value cannot fit into a Long.", GetErrorMessage(E_NUM_FORMAT));
+
+ ret = tmpRet;
+ return E_SUCCESS;
+}
+
+char
+Long::ToChar(void) const
+{
+ return static_cast<char> (value);
+}
+
+short
+Long::ToShort(void) const
+{
+ return static_cast<short> (value);
+}
+
+int
+Long::ToInt(void) const
+{
+ return static_cast<int> (value);
+}
+
+long
+Long::ToLong(void) const
+{
+ return value;
+}
+
+long long
+Long::ToLongLong(void) const
+{
+ return static_cast<long long> (value);
+}
+
+float
+Long::ToFloat(void) const
+{
+ return static_cast<float> (value);
+}
+
+double
+Long::ToDouble(void) const
+{
+ return static_cast<double> (value);
+}
+
+String
+Long::ToString(void) const
+{
+ return(Long::ToString(value));
+}
+
+String
+Long::ToString(long value)
+{
+ const static unsigned int LONG_LENGTH_MAX = 11;
+
+ wchar_t sValue[LONG_LENGTH_MAX + 1] = {0, };
+//UI_CORE
+// swprintf(sValue, (sizeof(sValue) / sizeof(sValue[0])), L"%d", value);
+ swprintf(sValue, L"%d", value);
+
+ return String(sValue);
+}
+
+}} //Tizen::Base
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseLongLong.cpp
+ * @brief This is the implementation file for LongLong class.
+ * @see Number
+ */
+
+#include <wchar.h>
+#include <limits.h>
+#include <errno.h>
+#include <FBaseLongLong.h>
+#include <FBaseResult.h>
+#include <FBaseCharacter.h>
+#include <FBaseSysLog.h>
+
+namespace Tizen { namespace Base
+{
+
+LongLong::LongLong(long long value)
+ : value(value)
+ , __pLongLongImpl(null)
+{
+}
+
+LongLong::LongLong(const LongLong& value)
+ : value(value.value)
+ , __pLongLongImpl(null)
+{
+}
+
+LongLong::~LongLong(void)
+{
+}
+
+LongLong&
+LongLong::operator =(const LongLong& rhs)
+{
+ if (&rhs != this)
+ {
+ value = rhs.value;
+ }
+ return *this;
+}
+
+int
+LongLong::Compare(long long l1, long long l2)
+{
+ return (int) (l1 < l2 ? -1 : (l1 == l2 ? 0 : 1));
+}
+
+int
+LongLong::CompareTo(const LongLong& value) const
+{
+ return(LongLong::Compare(this->value, value.value));
+}
+
+bool
+LongLong::Equals(const Object& obj) const
+{
+ const LongLong* pOther = dynamic_cast <const LongLong*>(&obj);
+ if (pOther == null)
+ {
+ return false;
+ }
+
+ return value == (*pOther).value;
+}
+
+int
+LongLong::GetHashCode(void) const
+{
+ return static_cast<int> (value);
+}
+
+int
+LongLong::GetHashCode(long long val)
+{
+ return static_cast<int> (val);
+}
+
+char
+LongLong::ToChar(void) const
+{
+ return static_cast<char> (value);
+}
+
+short
+LongLong::ToShort(void) const
+{
+ return static_cast<short> (value);
+}
+
+int
+LongLong::ToInt(void) const
+{
+ return static_cast<int> (value);
+}
+
+long
+LongLong::ToLong(void) const
+{
+ return static_cast<long> (value);
+}
+
+float
+LongLong::ToFloat(void) const
+{
+ return static_cast<float> (value);
+}
+
+double
+LongLong::ToDouble(void) const
+{
+ return static_cast<double> (value);
+}
+
+long long
+LongLong::ToLongLong(void) const
+{
+ return value;
+}
+
+String
+LongLong::ToString(void) const
+{
+ return(LongLong::ToString(value));
+}
+
+String
+LongLong::ToString(long long value)
+{
+ const static unsigned int LONG_LONG_LENGTH_MAX = 20;
+
+ wchar_t sValue[LONG_LONG_LENGTH_MAX + 1];
+
+ wmemset(sValue, 0, sizeof(sValue) / sizeof(sValue[0]));
+//UI_CORE
+// swprintf(sValue, (sizeof(sValue) / sizeof(sValue[0])), L"%lld", value);
+ swprintf(sValue, L"%lld", value);
+
+ return String(sValue);
+}
+
+result
+LongLong::Parse(const String& s, long long& ret)
+{
+ wchar_t* pEnd = null;
+
+ int len = s.GetLength();
+ SysTryReturnResult(NID_BASE, (len > 0), E_NUM_FORMAT, "[%s] The length of s MUST be greater than 0.",
+ GetErrorMessage(E_NUM_FORMAT));
+
+ return Parse(s, Character::RADIX_DECIMAL, ret);
+}
+
+result
+LongLong::Parse(const String& s, int radix, long long& ret)
+{
+ SysTryReturnResult(NID_BASE, radix == Character::RADIX_BINARY || radix == Character::RADIX_OCTAL ||
+ radix == Character::RADIX_DECIMAL || radix == Character::RADIX_HEXADECIMAL, E_OUT_OF_RANGE,
+ "[%s] The radix(%d) MUST be one of 2, 8, 10 and 16.", GetErrorMessage(E_OUT_OF_RANGE), radix);
+
+ int len = s.GetLength();
+ SysTryReturnResult(NID_BASE, (len > 0), E_NUM_FORMAT, "[%s] The length of s MUST be greater than 0.",
+ GetErrorMessage(E_NUM_FORMAT));
+
+ errno = 0;
+ wchar_t* pEnd = null;
+ long long tmpRet = wcstoll(s.GetPointer(), &pEnd, radix);
+ SysTryReturnResult(NID_BASE, (pEnd[0] == 0), E_NUM_FORMAT, "[%s] LongLong parse failed. Scan stopped at (%ls).",
+ GetErrorMessage(E_NUM_FORMAT), pEnd);
+ SysTryReturnResult(NID_BASE, !(errno == ERANGE && (tmpRet == LLONG_MAX || tmpRet == LLONG_MIN)), E_NUM_FORMAT,
+ "[%s] Parsed value cannot fit into a long long.", GetErrorMessage(E_NUM_FORMAT));
+
+ ret = tmpRet;
+ return E_SUCCESS;
+}
+
+}} //Tizen::Base
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseShort.cpp
+ * @brief This is the implementation file for Short class.
+ * @see Number
+ */
+
+#include <wchar.h>
+#include <limits.h>
+#include <errno.h>
+#include <FBaseShort.h>
+#include <FBaseResult.h>
+#include <FBaseCharacter.h>
+#include <FBaseSysLog.h>
+
+namespace Tizen { namespace Base
+{
+
+Short::Short(short value)
+ : value(value)
+ , __pShortImpl(null)
+{
+}
+
+Short::Short(const Short& value)
+ : value(value.value)
+ , __pShortImpl(null)
+{
+}
+
+Short::~Short(void)
+{
+}
+
+Short&
+Short::operator =(const Short& rhs)
+{
+ if (&rhs != this)
+ {
+ value = rhs.value;
+ }
+ return *this;
+}
+
+int
+Short::Compare(short s1, short s2)
+{
+ return(s1 < s2 ? -1 : (s1 == s2 ? 0 : 1));
+}
+
+int
+Short::CompareTo(const Short& value) const
+{
+ return(Short::Compare(this->value, value.value));
+}
+
+bool
+Short::Equals(const Object& obj) const
+{
+ const Short* pOther = dynamic_cast <const Short*>(&obj);
+ if (pOther == null)
+ {
+ return false;
+ }
+
+ return value == (*pOther).value;
+}
+
+bool
+Short::Equals(short value) const
+{
+ return this->value == value;
+}
+
+int
+Short::GetHashCode(void) const
+{
+ return static_cast<int> (value);
+}
+
+int
+Short::GetHashCode(short val)
+{
+ return static_cast<int> (val);
+}
+
+result
+Short::Decode(const String& s, short& ret)
+{
+ SysTryReturn(NID_BASE, s.GetLength() >= 1, E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] The length of s MUST be greater than 0.", GetErrorMessage(E_NUM_FORMAT));
+
+ long value = 0;
+ int radix = 0;
+ wchar_t* pEnd = null;
+ String str(s);
+
+ // Find radix
+ if (s[0] == L'#')
+ {
+ radix = Character::RADIX_HEXADECIMAL;
+
+ // Remove '#'
+ str.Remove(0, 1);
+ }
+ else if (s[0] == L'0' && (s.GetLength() >= 2))
+ {
+ if (s[1] == L'x' || s[1] == L'X')
+ {
+ radix = Character::RADIX_HEXADECIMAL;
+ }
+ else
+ {
+ radix = Character::RADIX_OCTAL;
+ }
+ }
+ else
+ {
+ radix = Character::RADIX_DECIMAL;
+ }
+
+ result r = E_SUCCESS;
+
+ errno = 0;
+ value = wcstol(str.GetPointer(), &pEnd, radix);
+ SysTryCatch(NID_BASE, (pEnd[0] == 0), r = E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] Short decode failed. Scan stopped at (%ls).", GetErrorMessage(E_NUM_FORMAT), pEnd);
+ SysTryCatch(NID_BASE, !((value == LONG_MAX || value == LONG_MIN) && (errno != 0)), r = E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] Decoded value cannot fit into Short.", GetErrorMessage(E_NUM_FORMAT));
+
+CATCH:
+ if (value > Short::VALUE_MAX)
+ {
+ ret = Short::VALUE_MAX;
+ }
+ else if (value < Short::VALUE_MIN)
+ {
+ ret = Short::VALUE_MIN;
+ }
+ else
+ {
+ ret = (short) value;
+ }
+
+ return r;
+}
+
+result
+Short::Parse(const String& s, short& ret)
+{
+ int len = s.GetLength();
+ SysTryReturn(NID_BASE, (len > 0 && len < 7), E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] The length of s(%ls) MUST be greater than 0 and less than 7.", GetErrorMessage(E_NUM_FORMAT), s.GetPointer());
+
+ return Parse(s, Character::RADIX_DECIMAL, ret);
+}
+
+result
+Short::Parse(const String& s, int radix, short& ret)
+{
+ SysTryReturn(NID_BASE, ((radix == Character::RADIX_BINARY) || (radix == Character::RADIX_OCTAL) ||
+ (radix == Character::RADIX_DECIMAL) || (radix == Character::RADIX_HEXADECIMAL)), E_OUT_OF_RANGE, E_OUT_OF_RANGE,
+ "[%s] The radix(%d) MUST be one of 2, 8, 10 and 16.", GetErrorMessage(E_OUT_OF_RANGE), radix);
+
+ int len = s.GetLength();
+ SysTryReturn(NID_BASE, (len > 0), E_NUM_FORMAT, E_NUM_FORMAT, "[%s] The length of s MUST be greater than 0.",
+ GetErrorMessage(E_NUM_FORMAT));
+
+ result r = E_SUCCESS;
+
+ errno = 0;
+ wchar_t* pEnd = null;
+ long value = wcstol(s.GetPointer(), &pEnd, radix);
+ SysTryReturn(NID_BASE, (pEnd[0] == 0), E_NUM_FORMAT, E_NUM_FORMAT,
+ "[%s] Short parse failed. Scan stopped at (%ls).", GetErrorMessage(E_NUM_FORMAT), pEnd);
+ SysTryReturn(NID_BASE, !(value > Short::VALUE_MAX || value < Short::VALUE_MIN) || (errno != 0), E_NUM_FORMAT,
+ E_NUM_FORMAT, "[%s] Parsed value cannot fit into Short.", GetErrorMessage(E_NUM_FORMAT));
+
+ if (value > Short::VALUE_MAX)
+ {
+ ret = Short::VALUE_MAX;
+ }
+ else if (value < Short::VALUE_MIN)
+ {
+ ret = Short::VALUE_MIN;
+ }
+ else
+ {
+ ret = static_cast< short >(value);
+ }
+
+ return r;
+}
+
+char
+Short::ToChar(void) const
+{
+ return static_cast<char> (value);
+}
+
+short
+Short::ToShort(void) const
+{
+ return value;
+}
+
+int
+Short::ToInt(void) const
+{
+ return static_cast<int> (value);
+}
+
+long
+Short::ToLong(void) const
+{
+ return static_cast<long> (value);
+}
+
+long long
+Short::ToLongLong(void) const
+{
+ return static_cast<long long> (value);
+}
+
+float
+Short::ToFloat(void) const
+{
+ return static_cast<float> (value);
+}
+
+double
+Short::ToDouble(void) const
+{
+ return static_cast<double> (value);
+}
+
+String
+Short::ToString(void) const
+{
+ return(Short::ToString(value));
+}
+
+String
+Short::ToString(short value)
+{
+ const static unsigned int SHORT_LENGTH_MAX = 6;
+
+ wchar_t sValue[SHORT_LENGTH_MAX + 1] = {0, };
+//UI-CORE
+// swprintf(sValue, (sizeof(sValue) / sizeof(sValue[0])), L"%d", value);
+ swprintf(sValue, L"%d", value);
+
+ return String(sValue);
+}
+
+}} //Tizen::Base
//
+// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
* @file FBaseString.cpp
* @brief This is the implementation for String class.
*/
+
#include <wchar.h>
#include <math.h>
#include <stdlib.h>
#include <stdarg.h>
#include <new>
#include <FBaseString.h>
-#ifdef TEST
#include <FBaseInt8.h>
#include <FBaseShort.h>
#include <FBaseInteger.h>
#include <FBaseLongLong.h>
#include <FBaseFloat.h>
#include <FBaseDouble.h>
-#endif
#include <FBaseCharacter.h>
#include <FBaseResult.h>
#include <FBaseSysLog.h>
#include <unique_ptr.h>
-#include "FBaseUtil_AtomicOperations.h"
-#ifdef _SUPPORT_UNICODE_
-#include "FBaseUtil_IcuConverter.h"
-#endif
+
namespace Tizen { namespace Base
{
const float String::GROWTH_FACTOR = 1.5;
-//const int String::UNSHAREABLE = Integer::VALUE_MAX;
-const int String::UNSHAREABLE = (int) 0x7FFFFFFF;
String::String(void)
: __capacity(0)
SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
}
-String::String(wchar_t ch)
+String::String(const wchar_t ch)
: __capacity(0)
, __length(0)
, __hash(0)
, __pValue(null)
, __pStringImpl(null)
{
+ int length = (pValue != null) ? wcslen(pValue) : 0;
+
+ SysTryReturnVoidResult(NID_BASE, length >= 0, E_OUT_OF_RANGE,
+ "String has wrong length. The length has to be more bigger than 0.");
+
if (pValue == null)
{
result r = InitializeToDefault(DEFAULT_CAPACITY);
}
else
{
- int length = wcslen(pValue);
result r = InitializeToDefault(length + DEFAULT_CAPACITY);
SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
-
+
wcsncpy(__pValue, pValue, length);
__pValue[length] = '\0';
__length = length;
}
}
-#ifndef _SUPPORT_UNICODE_
-wchar_t* __CharToWcharN(const char* pChar)
-{
- int len = strlen(pChar)+1;
- wchar_t* pWChar = new wchar_t[len];
-
- for(int i=0;i<len;i++)
- {
- pWChar[i]=pChar[i];
- }
- pWChar[len-1]='\0';
- return pWChar;
-
-}
-#endif
String::String(const char* pValue)
: __capacity(0)
, __length(0)
, __pValue(null)
, __pStringImpl(null)
{
- if (pValue == null || strlen(pValue) == 0)
+ int len = (pValue != null) ? mbstowcs(null, pValue, 0) : 0;
+
+ if (pValue == null)
{
result r = InitializeToDefault(DEFAULT_CAPACITY);
SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
}
else
{
- std::unique_ptr< int > pRefCntTemp(new (std::nothrow) int(1));
- SysTryReturnVoidResult(NID_BASE, pRefCntTemp != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
-#ifdef _SUPPORT_UNICODE_
- std::unique_ptr< wchar_t[] > pStr(Tizen::Base::Utility::Utf8ToWcharN(pValue));
-#else
- std::unique_ptr< wchar_t[] > pStr(__CharToWcharN(pValue));
-#endif
- SysTryReturnVoidResult(NID_BASE, pStr != null, GetLastResult(), "[%ls] Propagating.", GetErrorMessage(GetLastResult()));
+ result r = InitializeToDefault(len + DEFAULT_CAPACITY);
+ SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
- __pRefCount = pRefCntTemp.release();
- __pValue = pStr.release();
- __length = wcslen(__pValue);
- __capacity = __length + DEFAULT_CAPACITY;
- __pValue[__length] = '\0';
+ len = mbstowcs(__pValue, pValue, len);
+ if (len == -1)
+ {
+ SysLog(NID_BASE, "Invalid encoding range[%s].", pValue);
+ }
+ __pValue[len] = '\0';
+ __length = len;
}
}
String::String(const String& value)
- : __capacity(0)
- , __length(0)
- , __hash(0)
+ : __capacity(value.__capacity)
+ , __length(value.__length)
+ , __hash(value.__hash)
, __pRefCount(null)
- , __pValue(null)
+ , __pValue(value.__pValue)
, __pStringImpl(null)
{
- if (*(value.__pRefCount) != UNSHAREABLE)
- {
- Utility::_AtomicOperations::AtomicInc(value.__pRefCount);
- __pRefCount = value.__pRefCount;
- __pValue = value.__pValue;
- __capacity = value.__capacity;
- __length = value.__length;
- __hash = value.__hash;
- }
- else
- {
- int length = wcslen(value.__pValue);
-
- result r = InitializeToDefault(length + DEFAULT_CAPACITY);
- SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ SysTryReturnVoidResult(NID_BASE, value.__length >= 0, E_OUT_OF_RANGE, "The length has to be greater than 0.");
- wcsncpy(__pValue, value.__pValue, length);
- __pValue[length] = '\0';
- __length = length;
- }
+ ++(*value.__pRefCount);
+ __pRefCount = value.__pRefCount;
}
String::~String(void)
{
- if (*__pRefCount == 1 || *__pRefCount == UNSHAREABLE)
+ if (*__pRefCount == 1)
{
delete[] __pValue;
delete __pRefCount;
}
else
{
- Utility::_AtomicOperations::AtomicDec(__pRefCount);
+ (*__pRefCount)--;
__pRefCount = null;
}
}
"[%s] The index(%d) MUST be greater than or equal to 0, and less than the length of this string(%d).",
GetErrorMessage(E_OUT_OF_RANGE), index, __length);
- result r = AboutToModify(__capacity, true);
- SysTryReturn(NID_BASE, r == E_SUCCESS, ch, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 1)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturn(NID_BASE, r == E_SUCCESS, ch, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
__hash = 0;
return __pValue[index];
return *this;
}
-#ifdef TEST
String&
String::operator +=(const wchar_t* pRhs)
{
return str;
}
-#endif
bool
String::operator ==(const String& rhs) const
{
return(__length == 0);
}
-#ifdef TEST
+
result
String::Append(wchar_t ch)
{
}
result
-String::Append(const String& str)
-{
- if (str.IsEmpty())
- {
- return E_SUCCESS;
- }
-
- result r = Append(str.__pValue);
- SysTryReturn(NID_BASE, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
-
- return r;
-}
-#endif
-
-result
String::Append(const wchar_t* p)
{
SysTryReturnResult(NID_BASE, p != null, E_INVALID_ARG, "p is null.");
int length = (wcslen(p) + __length);
- if (*__pRefCount > 1 && *__pRefCount != UNSHAREABLE)
+ if (*__pRefCount > 1)
{
wchar_t* pValue = __pValue;
SysTryReturnResult(NID_BASE, AllocateCapacity(length) != false, E_OUT_OF_MEMORY, "Memory allocation failed.");
- std::unique_ptr< int > pRefCntTemp(new (std::nothrow) int(1));
+ std::unique_ptr<int> pRefCntTemp(new (std::nothrow) int(1));
SysTryReturnResult(NID_BASE, pRefCntTemp != null, E_OUT_OF_MEMORY, "Memory allocation failed");
wcsncpy(__pValue, pValue, __length);
- Utility::_AtomicOperations::AtomicDec(__pRefCount);
+ (*__pRefCount)--;
__pRefCount = pRefCntTemp.release();
}
return E_SUCCESS;
}
+result
+String::Append(const String& str)
+{
+ if (str.IsEmpty())
+ {
+ return E_SUCCESS;
+ }
+
+ result r = Append(str.__pValue);
+ SysTryReturn(NID_BASE, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
+
+ return r;
+}
+
void
String::Clear(void)
{
bool
String::Equals(const Object& obj) const
{
- const String* pOther = dynamic_cast< const String* >(&obj);
+ const String* pOther = dynamic_cast <const String*>(&obj);
if (pOther == null)
{
bool
String::Equals(const String& str, bool caseSensitive) const
{
-#ifndef BUILD_UI_CORE
+ //========UI_CORE
+ std::wstring source(__pValue);
+ std::wstring target(str.__pValue);
+ //========
if (caseSensitive)
{
return(*this == str);
return true;
}
- if (wcscasecmp(__pValue, str.__pValue) == 0)
+// if (wcscasecmp(__pValue, str.__pValue) == 0)
+ if (source == target)
{
return true;
}
return false;
}
-#endif
- return false;
}
+
+
result
String::Format(int length, const wchar_t* pFormat, ...)
{
-#ifndef BUILD_UI_CORE
int index = -1;
result r = E_SUCCESS;
Clear();
- std::unique_ptr< wchar_t[] > pStr(new (std::nothrow) wchar_t[length + 1]);
+ std::unique_ptr<wchar_t []> pStr(new (std::nothrow) wchar_t[length + 1]);
SysTryReturnResult(NID_BASE, pStr != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
pStr[length] = '\0';
va_list args;
va_start(args, pFormat);
- vswprintf(pStr.get(), length, tempStr.__pValue, args);
+ vswprintf(pStr.get(), tempStr.__pValue, args);
va_end(args);
this->__hash = 0;
return E_SUCCESS;
-#endif
-
- return E_FAILURE;
}
int
result
String::IndexOf(const String& str, int startIndex, int& indexOf) const
{
- SysTryReturnResult(NID_BASE, startIndex < __length, E_OUT_OF_RANGE,
+ SysTryReturnResult(NID_BASE, (startIndex < __length), E_OUT_OF_RANGE,
"The startIndex(%d) MUST be less than the length of this string(%d).", startIndex, __length);
- SysTryReturnResult(NID_BASE, startIndex >= 0, E_OUT_OF_RANGE,
+ SysTryReturnResult(NID_BASE, (startIndex >= 0), E_OUT_OF_RANGE,
"The startIndex(%d) MUST be greater than or equal to 0.", startIndex);
if (str.IsEmpty())
return E_SUCCESS;
}
-#ifdef TEST
+
result
String::Insert(wchar_t ch, int indexAt)
{
"The indexAt(%d) MUST be greater than or equal to 0, and less than or equal to the length of this string(%d).",
indexAt, __length);
- result r = AboutToModify(__capacity);
- SysTryReturnResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 1)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
int length = (__length + 1);
- r = EnsureCapacity(length);
+ result r = EnsureCapacity(length);
SysTryReturn(NID_BASE, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
wmemmove((__pValue + indexAt + 1), (__pValue + indexAt), ((__length + 1) - indexAt));
return E_SUCCESS;
}
- result r = AboutToModify(__capacity);
- SysTryReturnResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 1)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
- r = EnsureCapacity(__length + length);
+ result r = EnsureCapacity(__length + length);
SysTryReturn(NID_BASE, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
wmemmove((__pValue + indexAt + length), (__pValue + indexAt), ((__length + 1) - indexAt));
return r;
}
-#endif
+
result
String::LastIndexOf(wchar_t ch, int startIndex, int& indexOf) const
{
"The startIndex(%d) + count(%d) MUST be less than or equal to the length of this string(%d).",
startIndex, count, __length);
- result r = AboutToModify(__capacity);
- SysTryReturnResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 1)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
wmemmove(__pValue + startIndex, __pValue + moveIndex, (__length - moveIndex) + 1);
__length -= count;
void
String::Replace(wchar_t original, wchar_t replace)
{
- result r = AboutToModify(__capacity);
- SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 1)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
for (int length = __length; length >= 0; --length)
{
if (count > 0)
{
- result r = AboutToModify(__capacity);
- SysTryReturnResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 1)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
const int newLength = (count * (repLen - orgLen)) + __length;
- r = EnsureCapacity(newLength);
+ result r = EnsureCapacity(newLength);
SysTryReturn(NID_BASE, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
wchar_t* pBeg = (__pValue + startIndex);
void
String::Reverse(void)
{
- result r = AboutToModify(__capacity);
- SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 0)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
wchar_t* pBeg = __pValue;
wchar_t* pEnd = __pValue + __length - 1;
SysTryReturnResult(NID_BASE, capacity >= 0, E_INVALID_ARG,
"The capacity(%d) MUST be greater than or equal to 0.", capacity);
- std::unique_ptr< wchar_t[] > pValue(new (std::nothrow) wchar_t[capacity + 1]);
+ std::unique_ptr<wchar_t []> pValue(new (std::nothrow) wchar_t[capacity + 1]);
SysTryReturnResult(NID_BASE, pValue != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
if (__pValue != null)
}
else
{
- std::unique_ptr< int > pRefCntTemp(new (std::nothrow) int(1));
+ std::unique_ptr<int> pRefCntTemp(new (std::nothrow) int(1));
SysTryReturnResult(NID_BASE, pRefCntTemp != null, E_OUT_OF_MEMORY, "Memory allocation failed");
- Utility::_AtomicOperations::AtomicDec(__pRefCount);
+ (*__pRefCount)--;
__pRefCount = pRefCntTemp.release();
}
}
result
String::SetCharAt(wchar_t ch, int indexAt)
{
- SysTryReturn(NID_BASE, indexAt >= 0 && indexAt < __length, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
+ SysTryReturn(NID_BASE,indexAt >= 0 && indexAt < __length, E_OUT_OF_RANGE, E_OUT_OF_RANGE,
"[%s] The indexAt(%d) MUST be greater than or equal to 0, and less then the length of this string(%d).",
GetErrorMessage(E_OUT_OF_RANGE), indexAt, __length);
- result r = AboutToModify(__capacity);
- SysTryReturnResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 1)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
__pValue[indexAt] = ch;
__hash = 0;
SysTryReturnResult(NID_BASE, newLength >= 0, E_INVALID_ARG, "The newLength(%d) MUST be greater than or equal to 0.",
newLength);
- result r = AboutToModify(__capacity);
- SysTryReturnResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 1)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
static const wchar_t SPACE = 0x0020;
- r = EnsureCapacity(newLength);
+ result r = EnsureCapacity(newLength);
SysTryReturn(NID_BASE, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
if (newLength > __length)
if (length > 0)
{
- std::unique_ptr< wchar_t[] > pTemp(new (std::nothrow) wchar_t[length + 1]);
+ std::unique_ptr<wchar_t []> pTemp(new (std::nothrow) wchar_t[length + 1]);
SysTryReturnResult(NID_BASE, pTemp != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
wcsncpy(pTemp.get(), __pValue + startIndex, length);
pTemp[length] = '\0';
SysTryReturn(NID_BASE, startIndex >= 0 && startIndex < __length, false, E_OUT_OF_RANGE,
"[%s] The startIndex(%d) MUST be greater than or equal to 0, and less than the length of this string(%d).",
GetErrorMessage(E_OUT_OF_RANGE), startIndex, __length);
- SysTryReturn(NID_BASE, str.__length > 0, false, E_INVALID_ARG,
+ SysTryReturn(NID_BASE, str.__length > 0, false, E_INVALID_ARG,
"[%s] Invalid argument is used. The length of str(%d) MUST be greater than 0.",
GetErrorMessage(E_INVALID_ARG), str.__length);
void
String::ToLower(void)
{
- result r = AboutToModify(__capacity);
- SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 1)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
String str(__length + 1);
void
String::ToLowerCase(void)
{
- result r = AboutToModify(__capacity);
- SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 0)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
String str(__length + 1);
void
String::ToUpper(void)
{
- result r = AboutToModify(__capacity);
- SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 1)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
String str(__length + 1);
void
String::ToUpperCase(void)
{
- result r = AboutToModify(__capacity);
- SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ if (*__pRefCount > 1)
+ {
+ result r = CopyOnWrite(__capacity);
+ SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ }
String str(__length + 1);
--lastIndex;
}
- bool trimRight = lastIndex < __length;
- bool trimLeft = startIndex > 0;
-
- if (!trimRight && !trimLeft) // nothing to trim
- {
- return;
- }
-
- result r = AboutToModify(__capacity);
- SysTryReturnVoidResult(NID_BASE, r == E_SUCCESS, E_OUT_OF_MEMORY, "Memory allocation failed");
-
- if (trimRight)
+ // trim right
+ if (lastIndex < __length)
{
Remove(lastIndex, __length - lastIndex);
}
- if (trimLeft)
+ // trim left
+ if (startIndex > 0)
{
Remove(0, startIndex);
}
return true;
}
- return (wcsstr(__pValue, str.__pValue) != null);
+ wchar_t* pStart = __pValue;
+ wchar_t* pEnd = pStart + __length;
+ while (pStart < pEnd)
+ {
+ while (wcsstr(pStart, str.__pValue) != null)
+ {
+ return true;
+ }
+ ++pStart;
+ }
+
+ return false;
}
bool
capacity = minCapacity;
}
- std::unique_ptr< wchar_t[] > pNewValue(new (std::nothrow) wchar_t[capacity + 1]); // + 1 for null character
+ std::unique_ptr<wchar_t []> pNewValue(new (std::nothrow) wchar_t[capacity + 1]); // + 1 for null character
SysTryReturn(NID_BASE, pNewValue != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed.",
GetErrorMessage(E_OUT_OF_MEMORY));
}
else
{
- std::unique_ptr< int > pRefCntTemp(new (std::nothrow) int(1));
+ std::unique_ptr<int> pRefCntTemp(new (std::nothrow) int(1));
SysTryReturn(NID_BASE, pRefCntTemp != null, false, E_OUT_OF_MEMORY, "[%s] Memory allocation failed",
GetErrorMessage(E_OUT_OF_MEMORY));
- Utility::_AtomicOperations::AtomicDec(__pRefCount);
+ (*__pRefCount)--;
__pRefCount = pRefCntTemp.release();
}
}
result
String::InitializeToDefault(int capacity)
{
- std::unique_ptr< int > pRefCntTemp(new (std::nothrow) int(1));
+ std::unique_ptr<int> pRefCntTemp(new (std::nothrow) int(1));
SysTryReturnResult(NID_BASE, pRefCntTemp != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
SysTryReturnResult(NID_BASE, AllocateCapacity(capacity) != false, E_OUT_OF_MEMORY, "Memory allocation failed.");
}
result
-String::AboutToModify(int capacity, bool isUnshareable)
+String::CopyOnWrite(int capacity)
{
- if (*__pRefCount > 1 && *__pRefCount != UNSHAREABLE)
- {
- wchar_t* pValue = __pValue;
- std::unique_ptr< int > pRefCntTemp(new (std::nothrow) int(1));
- SysTryReturnResult(NID_BASE, pRefCntTemp != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
- SysTryReturnResult(NID_BASE, AllocateCapacity(capacity), E_OUT_OF_MEMORY, "Memory allocation failed.");
-
- wcsncpy(__pValue, pValue, __length);
- __pValue[__length] = '\0';
-
- Utility::_AtomicOperations::AtomicDec(__pRefCount);
- __pRefCount = pRefCntTemp.release();
- }
-
- if (isUnshareable)
- {
- *__pRefCount = UNSHAREABLE;
- }
+ wchar_t* pValue = __pValue;
+ std::unique_ptr<int> pRefCntTemp(new (std::nothrow) int(1));
+ SysTryReturnResult(NID_BASE, pRefCntTemp != null, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ SysTryReturnResult(NID_BASE, AllocateCapacity(capacity) != false, E_OUT_OF_MEMORY, "Memory allocation failed.");
+ wcsncpy(__pValue, pValue, __length);
+ __pValue[__length] = '\0';
+ --(*__pRefCount);
+ __pRefCount = pRefCntTemp.release();
return E_SUCCESS;
}
#include <FBaseSysLog.h>
+#include <FBaseResult.h>
#include <assert.h>
+#include <j_utils.h>
+#include <stdio.h>
+#include <stdarg.h>
-void SysLogInternal(unsigned long id, const char* pFunction, int lineNumber, const char* pFormat, ...){}
-void SysLogExceptionInternal(unsigned long id, result r, const char* pFunction, int lineNumber, const char* pFormat, ...){}
-void SysLogTagInternal(unsigned long id, const char* pTag, const char* pFunction, int lineNumber, const char* pFormat, ...){}
-void SysLogExceptionTagInternal(unsigned long id, const char* pTag, result r, const char* pFunction, int lineNumber, const char* pFormat, ...){}
+void SysLogInternal(unsigned long id, const char* pFunction, int lineNumber, const char* pFormat, ...)
+{
+ char buf[1024];
+ char msg[1024];
+
+ va_list arg;
+ va_start(arg, pFormat);
+ vsprintf((char*)&buf, pFormat, arg);
+ sprintf((char*)&msg, "%i , %s, %i, %s", id, pFunction, lineNumber, &buf);
+ logMessage(msg);
+
+ va_end(arg);
+}
+void SysLogExceptionInternal(unsigned long id, result r, const char* pFunction, int lineNumber, const char* pFormat, ...)
+{
+ SetLastResult(r);
+ char buf[1024];
+ char msg[1024];
+
+ va_list arg;
+ va_start(arg, pFormat);
+ vsprintf((char*)&buf, pFormat, arg);
+ sprintf((char*)&msg, "%i , %s, %s, %i, %s", id, GetErrorMessage(r), pFunction, lineNumber, &buf);
+ logMessage(msg);
+
+ va_end(arg);
+}
+void SysLogTagInternal(unsigned long id, const char* pTag, const char* pFunction, int lineNumber, const char* pFormat, ...)
+{
+ char buf[1024];
+ char msg[1024];
+
+ va_list arg;
+ va_start(arg, pFormat);
+ vsprintf((char*)&buf, pFormat, arg);
+ sprintf((char*)&msg, "%i , %s, %s, %i, %s", id, pTag, pFunction, lineNumber, &buf);
+ logMessage(msg);
+
+ va_end(arg);
+}
+void SysLogExceptionTagInternal(unsigned long id, const char* pTag, result r, const char* pFunction, int lineNumber, const char* pFormat, ...)
+{
+ SetLastResult(r);
+ char buf[1024];
+ char msg[1024];
+
+ va_list arg;
+ va_start(arg, pFormat);
+ vsprintf((char*)&buf, pFormat, arg);
+ sprintf((char*)&msg, "%i , %s, %s, %s, %i, %s", id, pTag, GetErrorMessage(r), pFunction, lineNumber, &buf);
+ logMessage(msg);
+
+ va_end(arg);
+}
void SysAssertInternal(const char* pFileName, int lineNumber, const char* pFunction)
{
+ char msg[1024];
+ sprintf((char*)&msg, "%s , %i, %s", pFileName, lineNumber, pFunction);
+ logMessage(msg);
+
+
+ assert(true);
+}
+void SysAssertfInternal(const char* expr, const char* pFunction, int lineNumber, const char* pFormat, ...)
+{
+ char buf[1024];
+ char msg[1024];
+
+ va_list arg;
+ va_start(arg, pFormat);
+ vsprintf((char*)&buf, pFormat, arg);
+ sprintf((char*)&msg, "%s, %s, %i, %s", expr, pFunction, lineNumber, &buf);
+ logMessage(msg);
+
+ va_end(arg);
+
assert(true);
}
-void SysAssertfInternal(const char* expr, const char* pFunction, int lineNumber, const char* pFormat, ...){}
-void SysPropagateInternal(const char* pFunction, int lineNumber, unsigned long nid, result r){}
-void SysTryReturnResultInternal(unsigned long id, result r, const char* pFunction, int lineNumber, const char* pFormat, ...){}
+void SysPropagateInternal(const char* pFunction, int lineNumber, unsigned long nid, result r)
+{
+ SetLastResult(r);
+ char msg[1024];
+
+ sprintf((char*)&msg, "%s, %i, %i, %s", pFunction, lineNumber, nid, GetErrorMessage(r));
+ logMessage(msg);
+}
+void SysTryReturnResultInternal(unsigned long id, result r, const char* pFunction, int lineNumber, const char* pFormat, ...)
+{
+ SetLastResult(r);
+ char buf[1024];
+ char msg[1024];
+
+ va_list arg;
+ va_start(arg, pFormat);
+ vsprintf((char*)&buf, pFormat, arg);
+ sprintf((char*)&msg, "%i , %s, %s, %i, %s", id, GetErrorMessage(r), pFunction, lineNumber, &buf);
+ logMessage(msg);
+
+ va_end(arg);
+}
#include <FBaseColArrayList.h>
#include <FBaseColMapEntry.h>
#include <FBaseResult.h>
-#ifdef TEST
+//#ifdef TEST
#include <FBaseFloat.h>
-#endif
+//#endif
#include <FBaseSysLog.h>
namespace Tizen { namespace Base { namespace Collection
}
float newLoadFactor = 0;
-#ifdef TEST
- if (Float::Compare(loadFactor, 0) == 0)
+//#ifdef TEST
+ if (Tizen::Base::Float::Compare(loadFactor, 0) == 0)
{
newLoadFactor = DEFAULT_LOAD_FACTOR;
}
{
newLoadFactor = loadFactor;
}
-#endif
+//#endif
int newThreshold = static_cast< int >(newCapacity * newLoadFactor);
std::unique_ptr< IHashCodeProvider > pProvider(const_cast< IHashCodeProvider* >(&provider));
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseBoolean.h
+ * @brief This is the header file for the %Boolean class.
+ *
+ * This header file contains the declarations of the %Boolean class.
+ */
+#ifndef _FBASE_BOOLEAN_H_
+#define _FBASE_BOOLEAN_H_
+
+#include <FBaseObject.h>
+#include <FBaseString.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class Boolean
+ * @brief This class is the wrapper class for the @c bool data type.
+ *
+ * @since 2.0
+ *
+ * The %Boolean class wraps a bool type value. This enables passing a bool value to a method that only accepts an instance of the Object class.
+ * It provides methods to convert %Boolean instances to String and %String instances to %Boolean.
+ *
+ * The following example demonstrates how to use the %Boolean class.
+ *
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * void
+ * MyClass::Test(void)
+ * {
+ * Boolean b1(true);
+ *
+ * String string1(b1.ToString()); // string1 == L"true"
+ *
+ *
+ * // Compares the string1 with L"true"
+ * if (Boolean::Parse(string1))
+ * {
+ * // ...
+ * }
+ *
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ Boolean
+ : public Object
+{
+public:
+ /**
+ * Initializes this instance of the %Boolean class with the specified @c value.
+ *
+ * @since 2.0
+ *
+ * @param[in] value The input @c bool value to initialize the %Boolean instance
+ */
+ Boolean(bool value);
+
+ /**
+ * Copying of objects using this copy constructor is allowed.
+ *
+ * @since 2.0
+ *
+ * @param[in] value An instance of the %Boolean class
+ */
+ Boolean(const Boolean& value);
+
+ /**
+ * Initializes this instance of %Boolean with the specified input string. @n
+ * If the input is "true" (ignoring case), the object is initialized to @c true,
+ * else @c false.
+ *
+ * @since 2.0
+ *
+ * @param[in] value An instance of String
+ */
+ Boolean(const String& value);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~Boolean(void);
+
+ /**
+ * Compares the values of two %Boolean instances.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the values of the objects are equal, @n
+ * else @c false.
+ * @param[in] rhs An instance of %Boolean to compare with the current instance
+ */
+ bool operator ==(const Boolean& rhs) const;
+
+ /**
+ * Checks whether the two %Boolean instances are not equal.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the values of the objects are not equal, @n
+ * else @c false
+ * @param[in] rhs An instance of %Boolean to compare with the current instance
+ */
+ bool operator !=(const Boolean& rhs) const;
+
+ /**
+ * Copying of objects using this copy assignment operator is allowed.
+ *
+ * @since 2.0
+ *
+ * @param[in] rhs An instance of %Boolean
+ */
+ Boolean& operator =(const Boolean& rhs);
+
+ /**
+ * Converts an instance of the Object class to an instance of %Boolean and then
+ * compares it with the calling %Boolean instance.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the value of @c obj matches the value of the calling %Boolean instance, @n
+ * else @c false
+ * @param[in] obj A reference to the Object instance to compare with the calling %Boolean instance
+ * @see Tizen::Base::Object::Equals()
+ */
+ virtual bool Equals(const Object& obj) const;
+
+ /**
+ * Gets the hash value of the current instance.
+ *
+ * @since 2.0
+ *
+ * @return The hash value of the current instance
+ * @remarks The two Tizen::Base::Object::Equals() instances must return the same hash value. For better performance, @n
+ * the used hash function must generate a random distribution for all inputs.
+ */
+ virtual int GetHashCode(void) const;
+
+ /**
+ * Converts a bool value to an instance of %Boolean and then
+ * compares it with the calling %Boolean instance.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the parameter matches the calling %Boolean instance, @n
+ * else @c false
+ * @param[in] value The @c bool value to compare to this instance
+ */
+ bool Equals(bool value) const;
+
+ /**
+ * Returns the value of the calling object as @c bool.
+ *
+ * @since 2.0
+ *
+ * @return The value of the %Boolean instance as bool
+ */
+ bool ToBool(void) const;
+
+ /**
+ * Parses the specified string and converts it to a @c bool value.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the value of the specified string is "true", @n
+ * else @c false
+ * @param[in] s An instance of String
+ * @remarks This method is case sensitive. @n
+ * It only accepts lowercase strings.
+ *
+ * @code
+ * bool b1 = Boolean::Parse(trueString); // trueString is L"true"
+ * bool b1 = Boolean::Parse(falseString); // falseString is L"false"
+ * @endcode
+ */
+ static bool Parse(const String& s);
+
+ /**
+ * Parses the specified string and converts it to a @c bool value. @n
+ * Case sensitivity can be controlled.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the value of the specified string is "true", @n
+ * else @c false
+ * @param[in] s An instance of String
+ * @param[in] caseSensitive Set to @c true to perform a
+ * case sensitive comparison of string @c s
+ * @remarks If @c caseSensitive is @c true, L"True" returns @c false, else @c true.
+ *
+ * @code
+ * bool b1 = Boolean::Parse(L"True", false ); // Returns @c true
+ * bool b1 = Boolean::Parse(L"True", true); // Returns @c false
+ * @endcode
+ */
+ static bool Parse(const String& s, bool caseSensitive);
+
+ /**
+ * Converts the value of the calling instance from @c bool to String.
+ *
+ * @since 2.0
+ *
+ * @return @c true if this instance is @c true, @n
+ * else @c false
+ */
+ String ToString(void) const;
+
+ /**
+ * Converts a @c bool parameter to a String
+ * instance of the %String class and returns the string representation of the
+ * input @c bool value (@c true or @c false).
+ *
+ * @since 2.0
+ *
+ * @return @c true if the parameter is @c true, @n
+ * else @c false
+ * @param[in] value A @c bool value to convert to String
+ */
+ static String ToString(bool value);
+
+ /**
+ * Returns a %Boolean instance whose value corresponds to the
+ * primitive value @c true.
+ *
+ * @since 2.0
+ *
+ * @return A %Boolean instance equivalent to @c true
+ */
+ static const Boolean GetTrue(void);
+
+ /**
+ * Returns a %Boolean instance whose value corresponds to the primitive
+ * value @c false.
+ *
+ * @since 2.0
+ *
+ * @return A %Boolean instance equivalent to @c false
+ */
+ static const Boolean GetFalse(void);
+
+ /**
+ * A boolean value of this instance.
+ *
+ * @since 2.0
+ */
+ bool value;
+
+private:
+ friend class _BooleanImpl;
+ class _BooleanImpl * __pBooleanImpl;
+
+}; // Boolean
+
+}} // Tizen::Base
+
+#endif //_FBASE_BOOLEAN_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseDoubleComparer.h
+ * @brief This is the header file for the %DoubleComparer class.
+ *
+ * @see Double and Tizen::Base::Collection::IComparer
+ *
+ * This header file contains the declarations of the %DoubleComparer class.
+ */
+#ifndef _FBASE_DOUBLE_COMPARER_H_
+#define _FBASE_DOUBLE_COMPARER_H_
+
+#include <FBaseObject.h>
+#include <FBaseColIComparer.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class DoubleComparer
+ * @brief This class checks for equivalence between 2 instances of the Double type.
+ *
+ * @since 2.0
+ *
+ * The %DoubleComparer class checks for equivalence between 2 instances of the Double type.
+ *
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/collection_comparison.htm">Collection Comparisons</a>.
+ *
+ * The following example demonstrates how to use the %DoubleComparer class.
+ *
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * void
+ * MyClass::DoubleComparerSample(void)
+ * {
+ * Double d1(123);
+ * Double d2(124);
+ * DoubleComparer comparer;
+ *
+ * // Compare 2 instances of Double
+ * int cmp;
+ * comparer.Compare(d1, d2, cmp);
+ * if (cmp < 0)
+ * {
+ * // ...
+ * }
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ DoubleComparer
+ : public Object
+ , public virtual Tizen::Base::Collection::IComparer
+{
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.0
+ */
+ DoubleComparer(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~DoubleComparer(void);
+
+ /**
+ * Compares two given instances of type Double.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] obj1 The first instance of type %Double
+ * @param[in] obj2 The second instance of type %Double
+ * @param[out] cmp The result of comparison
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified object instances are not of the expected type.
+ * @remarks The value of @c cmp can be:
+ *
+ * @code
+ * < 0 if the value of @c obj1 is less than the value of @c obj2
+ * == 0 if the value of @c obj1 is equal to the value of @c obj2
+ * > 0 if the value of @c obj1 is greater than the value of @c obj2
+ * @endcode
+ */
+ virtual result Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const;
+
+
+private:
+ /**
+ * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ DoubleComparer(const DoubleComparer& obj);
+
+ /**
+ * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ DoubleComparer& operator =(const DoubleComparer& rhs);
+
+ friend class _DoubleComparerImpl;
+ class _DoubleComparerImpl * __pDoubleComparerImpl;
+
+}; // DoubleComparer
+
+}} // Tizen::Base
+
+#endif // _FBASE_DOUBLE_COMPARER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseFloatComparer.h
+ * @brief This is the header file for the %FloatComparer class.
+ *
+ * @see Float and Tizen::Base::Collection::IComparer
+ *
+ * This header file contains the declarations of the %FloatComparer class.
+ */
+#ifndef _FBASE_FLOAT_COMPARER_H_
+#define _FBASE_FLOAT_COMPARER_H_
+
+#include <FBaseObject.h>
+#include <FBaseColIComparer.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class FloatComparer
+ * @brief This class checks for equivalence between 2 instances of the Float type.
+ *
+ * @since 2.0
+ *
+ * The %FloatComparer class checks for equivalence between 2 instances of the Float type.
+ *
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/collection_comparison.htm">Collection Comparisons</a>.
+ *
+ * The following example demonstrates how to use the %FloatComparer class.
+ *
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * void
+ * MyClass::FloatComparerSample(void)
+ * {
+ * Float f1(123);
+ * Float f2(124);
+ * FloatComparer comparer;
+ *
+ * // Compares 2 instances of Float
+ * int cmp;
+ * comparer.Compare(f1, f2, cmp);
+ * if (cmp < 0)
+ * {
+ * // ...
+ * }
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ FloatComparer
+ : public Object
+ , public Tizen::Base::Collection::IComparer
+{
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.0
+ */
+ FloatComparer(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~FloatComparer(void);
+
+ /**
+ * Compares two given instances of type Float.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] obj1 The first instance of type Float
+ * @param[in] obj2 The second instance of type Float
+ * @param[out] cmp The result of comparison
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified object instances are not of the expected type.
+ * @remarks The value of @c cmp can be:
+ *
+ * @code
+ * < 0 if the value of @c obj1 is less than the value of @c obj2
+ * == 0 if the value of @c obj1 is equal to the value of @c obj2
+ * > 0 if the value of @c obj1 is greater than the value of @c obj2
+ * @endcode
+ */
+ virtual result Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const;
+
+
+private:
+ /**
+ * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ FloatComparer(const FloatComparer& obj);
+
+ /**
+ * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ FloatComparer& operator =(const FloatComparer& rhs);
+
+ friend class _FloatComparerImpl;
+ class _FloatComparerImpl * __pFloatComparerImpl;
+
+}; // FloatComparer
+
+}} // Tizen::Base
+
+#endif // _FBASE_FLOAT_COMPARER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseInt8.h
+ * @brief This is the header file for the %Int8 class.
+ *
+ * @see Tizen::Base::Number
+ *
+ * This header file contains the declarations of the %Int8 class.
+ */
+#ifndef _FBASE_INT8_H_
+#define _FBASE_INT8_H_
+
+#include <FBaseNumber.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class Int8
+ * @brief This class is the wrapper class for the @c signed @c char built-in type.
+ *
+ * @since 2.0
+ *
+ * The %Int8 class represents an integer value ranging from -128 to 127. The class is useful when passing an 8-bit
+ * signed integral value to a method that accepts only an instance of Object. Furthermore, this class provides
+ * methods for converting %Int8 (and @c char) to String, and %String to %Int8 (and @c char).
+ *
+ * The following example demonstrates how to use the %Int8 class.
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * // This method checks whether the given string object contains a string
+ * // representation of the pre-defined minimum 8-bit integral value.
+ * result
+ * MyClass::Verify(String& string, bool& out)
+ * {
+ * static const Int8 MINIMUM(123);
+ *
+ * result r = E_SUCCESS;
+ *
+ * char ch;
+ * r = Int8::Parse(string, ch);
+ * if (IsFailed(r))
+ * {
+ * goto CATCH;
+ * }
+ *
+ * out = (MINIMUM.CompareTo(ch) == 0) ? true: false;
+ *
+ * return r;
+ * CATCH:
+ * return r;
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ Int8
+ : public Number
+{
+public:
+ /**
+ * Initializes this instance of %Int8 with the specified value.
+ *
+ * @since 2.0
+ *
+ * @param[in] value A @c char value
+ */
+ Int8(char value = 0);
+
+
+ /**
+ * Copying of objects using this copy constructor is allowed.
+ *
+ * @since 2.0
+ *
+ * @param[in] value An instance of %Int8
+ */
+ Int8(const Int8& value);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~Int8(void);
+
+ /**
+ * Copying of objects using this copy assignment operator is allowed.
+ *
+ * @since 2.0
+ *
+ * @param[in] rhs An instance of %Int8
+ */
+ Int8& operator =(const Int8& rhs);
+
+ /**
+ * Compares two @c char values.
+ *
+ * @since 2.0
+ *
+ * @return A 32-bit @c signed integer value
+ * @code
+ * < 0 if the value of ch1 is less than the value of ch2
+ * == 0 if the value of ch1 is equal to the value of ch2
+ * > 0 if the value of ch1 is greater than the value of ch2
+ * @endcode
+ * @param[in] ch1 The first @c char value to compare
+ * @param[in] ch2 The second @c char value to compare
+ */
+ static int Compare(char ch1, char ch2);
+
+ /**
+ * Compares the value of the current instance with the value of the specified instance of the %Int8 class.
+ *
+ * @since 2.0
+ *
+ * @return A 32-bit @c signed integer value
+ * @code
+ * < 0 if the value of the current instance is less than the value of the specified instance
+ * == 0 if the value of the current instance is equal to the value of the specified instance
+ * > 0 if the value of the current instance is greater than the value of the specified instance
+ * @endcode
+ * @param[in] value An instance of the %Int8 class to compare
+ */
+ int CompareTo(const Int8& value) const;
+
+ /**
+ * Checks whether the value of the specified instance of %Int8 is equal to the value of the current instance.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the value of the specified instance is equal to the value of the current instance, @n
+ * else @c false
+ * @param[in] obj An instance of Object to compare
+ * @see Tizen::Base::Object::Equals()
+ */
+ virtual bool Equals(const Object& obj) const;
+
+ /**
+ * Gets the hash value of the current instance of %Int8.
+ *
+ * @since 2.0
+ *
+ * @return An integer value indicating the hash value of the current instance of %Int8
+ * @remarks Two equal instances must return the same hash value. For better performance,
+ * the used hash function must generate a random distribution for all inputs. @n
+ * The default implementation of this method returns the value of the current instance.
+ */
+ virtual int GetHashCode(void) const;
+
+ /**
+ * Gets the hash value of the specified @c char value.
+ *
+ * @since 2.0
+ *
+ * @return An integer value indicating the hash value of the specified @c char value
+ * @param[in] val A @c char value to get the hash value
+ */
+ static int GetHashCode(char val);
+
+ /**
+ * Decodes a string into a @c signed @c char.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A string representing a numeric value
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @remarks This method accepts decimal, hexadecimal, and octal numbers given by the
+ * following grammar:
+ * @code
+ * - DecodableString:
+ * Sign[opt] DecimalNumeral
+ * Sign[opt] 0x HexDigits
+ * Sign[opt] 0X HexDigits
+ * Sign[opt] # HexDigits
+ * Sign[opt] 0 OctalDigits
+ * - Sign:
+ * '-'
+ * @endcode
+ */
+ static result Decode(const String& s, char& ret);
+
+ /**
+ * Parses the @c signed @c char equivalent of the specified string representing a numeric value.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A string representing a numeric value
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a byte that can be parsed.
+ * @remarks
+ * - This method assumes that the string representing the numeric value uses a radix 10.
+ * - This method guarantees that the original value of out-parameter is not changed when the method returns error.
+ */
+ static result Parse(const String& s, char& ret);
+
+ /**
+ * Parses the specified string representing a numeric value and
+ * returns the value as @c signed @c char (as out parameter).
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c char equivalent of the specified string representing the numeric value using the specified index
+ * @param[in] s A string representing a numeric value
+ * @param[in] radix The radix of the string representing a numeric value @n
+ * It must either be 2, 8, 10, or 16.
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @exception E_OUT_OF_RANGE The specified @c radix is invalid.
+ * @remarks This method guarantees that the original value of out-parameter is not changed when the method returns error.
+ */
+ static result Parse(const String& s, int radix, char& ret);
+
+ /**
+ * Gets the @c signed @c char equivalent of the current instance of %Int8.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c char equivalent of the current instance
+ */
+ virtual char ToChar(void) const;
+
+ /**
+ * Gets the @c signed @c short equivalent of the current instance of %Int8.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c short equivalent of the current instance
+ */
+ virtual short ToShort(void) const;
+
+ /**
+ * Gets the @c signed @c int equivalent of the current instance of %Int8.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c int equivalent of the current instance
+ */
+ virtual int ToInt(void) const;
+
+ /**
+ * Gets the @c signed @c long equivalent of the current instance of %Int8.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c long equivalent of the current instance
+ */
+ virtual long ToLong(void) const;
+
+ /**
+ * Gets the @c signed @c long @c long equivalent of the current instance of %Int8.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c long @c long equivalent of the current instance
+ */
+ virtual long long ToLongLong(void) const;
+
+ /**
+ * Gets the @c signed @c float equivalent of the current instance of %Int8.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c float equivalent of the current instance
+ */
+ virtual float ToFloat(void) const;
+
+ /**
+ * Gets the @c signed @c double equivalent of the current instance of %Int8.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c double equivalent of the current instance
+ */
+ virtual double ToDouble(void) const;
+
+ /**
+ * Gets the string representing the value of the current instance of %Int8.
+ *
+ * @since 2.0
+ *
+ * @return A string representing the value of the current instance
+ */
+ virtual String ToString(void) const;
+
+ /**
+ * Gets the string representing the specified @c signed @c char value using radix @c 10.
+ *
+ * @since 2.0
+ *
+ * @return A string containing a Unicode representation of the specified @c char value using radix 10
+ * @param[in] value A @c char value
+ */
+ static String ToString(char value);
+
+ /**
+ * A constant holding the maximum value of type @c char. @n
+ * A @c short character can hold a value of upto 2^7-1.
+ *
+ * @since 2.0
+ */
+ static const char VALUE_MAX = (signed char) 0x7F;
+
+ /**
+ * A constant holding the minimum value of type @c char. @n
+ * A @c short character can hold a value of upto -2^7.
+ *
+ * @since 2.0
+ */
+ static const char VALUE_MIN = (signed char) 0x80;
+
+ /**
+ * A @c signed @c char value of this instance.
+ *
+ * @since 2.0
+ */
+ signed char value;
+
+
+private:
+ friend class _Int8Impl;
+ class _Int8Impl * __pInt8Impl;
+
+}; // Int8
+
+}} // Tizen::Base
+
+#endif //_FBASE_INT8_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseInt8Comparer.h
+ * @brief This is the header file for the %Int8Comparer class.
+ *
+ * @see Int8 and Tizen::Base::Collection::IComparer
+ *
+ * This header file contains the declarations of the %Int8Comparer class.
+ */
+#ifndef _FBASE_INT8_COMPARER_H_
+#define _FBASE_INT8_COMPARER_H_
+
+#include <FBaseTypes.h>
+#include <FBaseObject.h>
+#include <FBaseColIComparer.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class Int8Comparer
+ * @brief This class checks for equivalence between 2 instances of the Int8 type.
+ *
+ * @since 2.0
+ *
+ * The %Int8Comparer class checks for equivalence between 2 instances of the Int8 type.
+ *
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/collection_comparison.htm">Collection Comparisons</a>.
+ *
+ * The following example demonstrates how to use the %Int8Comparer class.
+ *
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * void
+ * MyClass::Int8ComparerSample(void)
+ * {
+ * Int8 i1(123);
+ * Int8 i2(124);
+ * Int8Comparer comparer;
+ *
+ * int cmp;
+ * comparer.Compare(i1, i2, cmp);
+ * if (cmp < 0)
+ * {
+ * // ...
+ * }
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ Int8Comparer
+ : public Object
+ , public virtual Tizen::Base::Collection::IComparer
+{
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.0
+ */
+ Int8Comparer(void);
+
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~Int8Comparer(void);
+
+ /**
+ * Compares two given instances of type Int8.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] obj1 The first instance of type Int8
+ * @param[in] obj2 The second instance of type Int8
+ * @param[out] cmp The result of comparison
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified object instances are not of the expected type.
+ * @remarks The value of @c cmp can be:
+ *
+ * @code
+ * < 0 if the value of @c obj1 is less than the value of @c obj2
+ * == 0 if the value of @c obj1 is equal to the value of @c obj2
+ * > 0 if the value of @c obj1 is greater than the value of @c obj2
+ * @endcode
+ */
+ virtual result Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const;
+
+
+private:
+ /**
+ * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ Int8Comparer(const Int8Comparer& obj);
+
+ /**
+ * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ Int8Comparer& operator =(const Int8Comparer& rhs);
+
+ friend class _Int8ComparerImpl;
+ class _Int8ComparerImpl * __pInt8ComparerImpl;
+
+}; // Int8Comparer
+
+}} // Tizen::Base
+
+#endif // _FBASE_INT8_COMPARER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseInteger.h
+ * @brief This is the header file for the %Integer class.
+ *
+ * @see Number() class()
+ *
+ * This header file contains the declarations of the %Integer class.
+ */
+#ifndef _FBASE_INTEGER_H_
+#define _FBASE_INTEGER_H_
+
+#include <FBaseNumber.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class Integer
+ * @brief This class is the wrapper class for the @c signed @c int built-in type.
+ *
+ * @since 2.0
+ *
+ * The %Integer class represents an integer value ranging from -2147483648 to 2147483647,
+ * that is, -(2^31) to +((2^31)-1). This class is useful when passing a 32-bit @c signed
+ * integral value to a method that accepts only an instance of Object. Furthermore,
+ * this class provides methods for converting %Integer (and @c int) to String, and %String
+ * to %Integer (and @c int).
+ *
+ * The following example demonstrates how to use the %Integer class.
+ *
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * // This method checks whether the given string object contains a string
+ * // representation of the pre-defined minimum 32-bit integral value.
+ * result
+ * MyClass::Verify(String& string, bool& out)
+ * {
+ * static const Integer MINIMUM(1230);
+ *
+ * result r = E_SUCCESS;
+ *
+ * int i;
+ * r = Integer::Parse(string, i);
+ * if (IsFailed(r))
+ * {
+ * goto CATCH;
+ * }
+ *
+ * out = (MINIMUM.CompareTo(i) == 0) ? true: false;
+ *
+ * return r;
+ * CATCH:
+ * return r;
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ Integer
+ : public Number
+{
+public:
+ /**
+ * Initializes this instance of %Integer with the specified value.
+ *
+ * @since 2.0
+ *
+ * @param[in] value An integer value
+ */
+ Integer(int value = 0);
+
+ /**
+ * Copying of objects using this copy constructor is allowed.
+ *
+ * @since 2.0
+ *
+ * @param[in] value An instance of %Integer
+ */
+ Integer(const Integer& value);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~Integer(void);
+
+ /**
+ * Copying of objects using this copy assignment operator is allowed.
+ *
+ * @since 2.0
+ *
+ * @param[in] rhs An instance of %Integer
+ */
+ Integer& operator =(const Integer& rhs);
+
+ /**
+ * Compares two @c int values.
+ *
+ * @since 2.0
+ *
+ * @return A 32-bit @c signed integer value
+ * @code
+ * < 0 if the value of @c i1 is less than the value of @c i2
+ * == 0 if the value of @c i1 is equal to the value of @c i2
+ * > 0 if the value of @c i1 is greater than the value of @c i2
+ * @endcode
+ * @param[in] i1 The first @c int value to compare
+ * @param[in] i2 The second @c int value to compare
+ */
+ static int Compare(int i1, int i2);
+
+ /**
+ * Compares the value of the current instance with the value of the specified instance of the %Integer class.
+ *
+ * @since 2.0
+ *
+ * @return A 32-bit @c signed integer value
+ *
+ * @code
+ * < 0 if the value of the current instance is less than the value of the specified instance
+ * == 0 if the value of the current instance is equal to the value of the specified instance
+ * > 0 if the value of the current instance is greater than the value of the specified instance
+ * @endcode
+ * @param[in] value An instance of the %Integer class to compare
+ */
+ int CompareTo(const Integer& value) const;
+
+ /**
+ * Checks whether the value of the specified instance of Object is equal to the value of the current instance of %Integer.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the value of the specified instance of Object is equal to the value of the current instance of %Integer, @n
+ * else @c false
+ * @param[in] obj An instance of Object to compare
+ * @see Tizen::Base::Object::Equals()
+ */
+ virtual bool Equals(const Object& obj) const;
+
+ /**
+ * Decodes a string into a @c signed @c int.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A string representing the numeric value
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @remarks This method accepts decimal, hexadecimal, and octal numbers given by the
+ * following grammar:
+ * @code
+ * - DecodableString:
+ * Sign[opt] DecimalNumeral
+ * Sign[opt] 0x HexDigits
+ * Sign[opt] 0X HexDigits
+ * Sign[opt] # HexDigits
+ * Sign[opt] 0 OctalDigits
+ * - Sign:
+ * '-'
+ * @endcode
+ */
+ static result Decode(const String& s, int& ret);
+
+ /**
+ * Gets the hash value of the current instance of %Integer.
+ *
+ * @since 2.0
+ *
+ * @return An integer value indicating the hash value of the current instance of %Integer
+ * @remarks Two equal instances must return the same hash value. For better performance,
+ * the used hash function must generate a random distribution for all inputs. @n
+ * The default implementation of this method returns the value of the current instance.
+ */
+ virtual int GetHashCode(void) const;
+
+ /**
+ * Gets the hash value of the specified @c int value.
+ *
+ * @since 2.0
+ *
+ * @return An integer value indicating the hash value of the specified @c int value
+ * @param[in] val A @c int value to get the hash value
+ */
+ static int GetHashCode(int val);
+
+ /**
+ * Parses the @c signed @c int equivalent of the specified string representing a numeric value.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A string representing a numeric value
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @remarks
+ * - This method assumes that the string representing the numeric value uses a radix 10.
+ * - This method guarantees that the original value of out-parameter is not changed when the method returns error.
+ */
+ static result Parse(const String& s, int& ret);
+
+ /**
+ * Parses the @c signed @c int equivalent of the specified string representing a numeric value using the specified radix.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A string representing a numeric value
+ * @param[in] radix The radix of the string representing the numeric value @n
+ * It must either be 2, 8, 10, or 16.
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @exception E_OUT_OF_RANGE The specified @c radix is invalid.
+ * @remarks This method guarantees that the original value of out-parameter is not changed when the method returns error.
+ */
+ static result Parse(const String& s, int radix, int& ret);
+
+ /**
+ * Gets the @c signed @c char equivalent of the current instance of the %Integer class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c char equivalent of the current instance
+ */
+ virtual char ToChar(void) const;
+
+ /**
+ * Gets the @c signed @c short equivalent of the current instance of the %Integer class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c short equivalent of the current instance
+ */
+ virtual short ToShort(void) const;
+
+ /**
+ * Gets the @c signed @c int equivalent of the current instance of the %Integer class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c int equivalent of the current instance
+ */
+ virtual int ToInt(void) const;
+
+ /**
+ * Gets the @c signed @c long equivalent of the current instance of the %Integer class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c long equivalent of the current instance
+ */
+ virtual long ToLong(void) const;
+
+ /**
+ * Gets the @c signed @c long @c long equivalent of the current instance of the %Integer class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c long @c long equivalent of the current instance
+ */
+ virtual long long ToLongLong(void) const;
+
+ /**
+ * Gets the @c signed @c float equivalent of the current instance of the %Integer class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c float equivalent of the current instance
+ */
+ virtual float ToFloat(void) const;
+
+ /**
+ * Gets the @c signed @c double equivalent of the current instance of the %Integer class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c double equivalent of the current instance
+ */
+ virtual double ToDouble(void) const;
+
+ /**
+ * Gets the string representing the value of the current instance of the %Integer class.
+ *
+ * @since 2.0
+ *
+ * @return A string representing the value of the current instance
+ */
+ virtual String ToString(void) const;
+
+ /**
+ * Gets the string representing the specified @c signed @c int value.
+ *
+ * @since 2.0
+ *
+ * @return A string containing a Unicode representation of the specified @c signed @c int value
+ * @param[in] value A @c signed @c int value to convert
+ */
+ static String ToString(int value);
+
+ /**
+ * A constant holding the maximum value of type @c int. @n
+ * A @c short integer can hold a value of upto 2^31-1.
+ *
+ * @since 2.0
+ */
+ static const int VALUE_MAX = (int) 0x7FFFFFFF;
+
+ /**
+ * A constant holding the minimum value of type @c int. @n
+ * A @c short integer can hold a value of upto -2^31.
+ *
+ * @since 2.0
+ */
+ static const int VALUE_MIN = (int) 0x80000000;
+
+ /**
+ * An integer value of this instance.
+ *
+ * @since 2.0
+ */
+ int value;
+
+
+private:
+ friend class _IntegerImpl;
+ class _IntegerImpl * __pIntegerImpl;
+
+}; // Integer
+
+}} //Tizen::Base
+
+#endif //_FBASE_INTEGER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseIntegerComparer.h
+ * @brief This is the header file for the %IntegerComparer class.
+ *
+ * @see Integer and Tizen::Base::Collection::IComparer
+ *
+ * This header file contains the declarations of the %IntegerComparer class.
+ */
+#ifndef _FBASE_INTEGER_COMPARER_H_
+#define _FBASE_INTEGER_COMPARER_H_
+
+#include <FBaseTypes.h>
+#include <FBaseObject.h>
+#include <FBaseColIComparer.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class IntegerComparer
+ * @brief This class checks for equivalence between 2 instances of the Integer type.
+ *
+ * @since 2.0
+ *
+ * The %IntegerComparer class checks for equivalence between 2 instances of the Integer type.
+ *
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/collection_comparison.htm">Collection Comparisons</a>.
+ *
+ * The following example demonstrates how to use the %IntegerComparer class.
+ *
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * void
+ * MyClass::IntegerComparerSample(void)
+ * {
+ * Integer i1(123);
+ * Integer i2(124);
+ * IntegerComparer comparer;
+ *
+ * int cmp;
+ * comparer.Compare(i1, i2, cmp);
+ * if (cmp < 0)
+ * {
+ * // ...
+ * }
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ IntegerComparer
+ : public Object
+ , public virtual Tizen::Base::Collection::IComparer
+{
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.0
+ */
+ IntegerComparer(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~IntegerComparer(void);
+
+ /**
+ * Compares two given instances of type Integer.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] obj1 The first instance of type %Integer
+ * @param[in] obj2 The second instance of type %Integer
+ * @param[out] cmp The result of comparison
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified object instances are not of the expected type.
+ * @remarks The value of @c cmp can be:
+ *
+ * @code
+ * < 0 if the value of @c obj1 is less than the value of @c obj2
+ * == 0 if the value of @c obj1 is equal to the value of @c obj2
+ * > 0 if the value of @c obj1 is greater than the value of @c obj2
+ * @endcode
+ */
+ virtual result Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const;
+
+
+private:
+ /**
+ * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ IntegerComparer(const IntegerComparer& obj);
+
+ /**
+ * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ IntegerComparer& operator =(const IntegerComparer& rhs);
+
+ friend class _IntegerComparerImpl;
+ class _IntegerComparerImpl * __pIntegerComparerImpl;
+
+}; // IntegerComparer
+
+}} // Tizen::Base
+
+#endif // _FBASE_INTEGER_COMPARER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseInternalTypes.h
+ * @brief This is the header file for the FBase internal types
+ */
+
+#ifndef _FBASE_INTERNAL_TYPES_H_
+#define _FBASE_INTERNAL_TYPES_H_
+
+namespace Tizen { namespace Base
+{
+
+/**
+ * @enum _ApiVersion
+ * Defines the Api version of the application
+ *
+ * @since 2.0
+ */
+typedef enum
+{
+ _API_VERSION_INVALID = -1, /**< Invalid Api version */
+ _API_VERSION_1_0 = 100, /**< Api version 1.0 */
+ _API_VERSION_1_0_2 = 102, /**< Api version 1.02 */
+ _API_VERSION_1_1 = 110, /**< Api version 1.1 */
+ _API_VERSION_1_2 = 120, /**< Api version 1.2 */
+ _API_VERSION_2_0 = 200, /**< Api version 2.0 */
+ _API_VERSION_2_1 = 210, /**< Api version 2.1 */
+ _API_VERSION_MAX = 65535
+} _ApiVersion;
+
+/**
+ * @enum _ApiVisibility
+ * Defines the visibility of the api
+ *
+ * @since 2.0
+ */
+enum _ApiVisibility
+{
+ _API_VISIBILITY_NONE = 0,
+ _API_VISIBILITY_PUBLIC = 100,
+ _API_VISIBILITY_PARTNER = 200,
+ _API_VISIBILITY_PARTNER_OPERATOR = 210,
+ _API_VISIBILITY_PARTNER_MANUFACTURER = 220,
+ _API_VISIBILITY_MAX = 65535
+};
+
+}} // Tizen::Base
+
+#endif // _FBASE_INTERNAL_TYPES_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseLong.h
+ * @brief This is the header file for the %Long class.
+ *
+ * @see Number()
+ *
+ * This header file contains the declarations of the %Long class.
+ */
+#ifndef _FBASE_LONG_H_
+#define _FBASE_LONG_H_
+
+#include <FBaseNumber.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class Long
+ * @brief This class is the wrapper class for the @c signed @c long built-in type.
+ *
+ * @since 2.0
+ *
+ * The %Long class represents an integer value ranging from -2147483648 to 2147483647
+ * , that is, -(2^31) to +((2^31)-1). The class is useful when passing a 32-bit @c signed
+ * integral value to a method that accepts only an instance of Object. Furthermore,
+ * this class provides methods for converting %Long (and @c long) to String, and %String
+ * to %Long (and @c long).
+ *
+ * The following example demonstrates how to use the %Long class.
+ *
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * // This method checks whether the given string object contains a string
+ * // representation of the pre-defined minimum 32-bit integral value
+ * result
+ * MyClass::Verify(String& string, bool& out)
+ * {
+ * static const Long MINIMUM(1230);
+ * result r = E_SUCCESS;
+ *
+ * long l;
+ * r = Long::Parse(string, l);
+ * if (IsFailed(r))
+ * {
+ * goto CATCH;
+ * }
+ *
+ * out = (MINIMUM.CompareTo(l) == 0) ? true: false;
+ *
+ * return r;
+ * CATCH:
+ * return r;
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ Long
+ : public Number
+{
+public:
+ /**
+ * Initializes this instance of %Long with the specified value.
+ *
+ * @since 2.0
+ *
+ * @param[in] value A @c long value
+ */
+ Long(long value = 0);
+
+ /**
+ * Copying of objects using this copy constructor is allowed.
+ *
+ * @since 2.0
+ *
+ * @param[in] value An instance of %Long
+ */
+ Long(const Long& value);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~Long(void);
+
+ /**
+ * Copying of objects using this copy assignment operator is allowed.
+ *
+ * @since 2.0
+ *
+ * @param[in] rhs An instance of %Long
+ */
+ Long& operator =(const Long& rhs);
+
+ /**
+ * Compares two @c long values.
+ *
+ * @since 2.0
+ *
+ * @return A 32-bit @c signed integer value
+ * @code
+ * < 0 if the value of @c l1 is less than the value of @c l2
+ * == 0 if the value of @c l1 is equal to the value of @c l2
+ * > 0 if the value of @c l1 is greater than the value of @c l2
+ * @endcode
+ * @param[in] l1 The first @c long value to compare
+ * @param[in] l2 The second @c long value to compare
+ */
+ static int Compare(long l1, long l2);
+
+ /**
+ * Compares the value of the current instance with the value of the specified instance of the %Long class.
+ *
+ * @since 2.0
+ *
+ * @return A 32-bit @c signed integer value
+ *
+ * @code
+ * < 0 if the value of the current instance is less than the value of the specified instance
+ * == 0 if the value of the current instance is equal to the value of the specified instance
+ * > 0 if the value of the current instance is greater than the value of the specified instance
+ * @endcode
+ * @param[in] value An instance of the %Long class to compare
+ */
+ int CompareTo(const Long& value) const;
+
+ /**
+ * Checks whether the value of the specified instance of %Object is equal to the value of the current instance of %Long.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the value of the specified instance of %Object is equal to the value of the current instance of %Long, @n
+ * else @c false
+ * @param[in] obj An instance of %Object to compare
+ * @see Object::Equals()
+ */
+ virtual bool Equals(const Object& obj) const;
+
+ /**
+ * Gets the hash value of the current instance of %Long.
+ *
+ * @since 2.0
+ *
+ * @return An integer value indicating the hash value of the current instance of %Long
+ * @remarks Two equal instances must return the same hash value. For better performance,
+ * the used hash function must generate a random distribution for all inputs. @n
+ * The default implementation of this method returns the value of the current instance.
+ */
+ virtual int GetHashCode(void) const;
+
+ /**
+ * Gets the hash value of the specified @c long value.
+ *
+ * @since 2.0
+ *
+ * @return An integer value indicating the hash value of the specified @c long value
+ * @param[in] val A @c long value to get the hash value
+ */
+ static int GetHashCode(long val);
+
+ /**
+ * Decodes a string into a @c signed @c long.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A string representing a numeric value
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @remarks This method accepts decimal, hexadecimal, and octal numbers given by the
+ * following grammar:
+ * @code
+ * - DecodableString:
+ * Sign[opt] DecimalNumeral
+ * Sign[opt] 0x HexDigits
+ * Sign[opt] 0X HexDigits
+ * Sign[opt] # HexDigits
+ * Sign[opt] 0 OctalDigits
+ * - Sign:
+ * '-'
+ * @endcode
+ */
+ static result Decode(const String& s, long& ret);
+
+ /**
+ * Parses the @c signed @c long equivalent of the specified string representing a numeric value.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A string representing a numeric value
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @remarks
+ * - This method assumes that the string representing the numeric value uses a radix 10.
+ * - This method guarantees that the original value of out-parameter is not changed when the method returns error.
+ */
+ static result Parse(const String& s, long& ret);
+
+ /**
+ * Parses the @c signed @c long equivalent of the specified string representing a numeric value using the specified radix.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A string representing a numeric value
+ * @param[in] radix The radix of the string representing a numeric value @n
+ * It must be either 2, 8, 10, or 16.
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @exception E_OUT_OF_RANGE The specified @c radix is invalid.
+ * @remarks This method guarantees that the original value of out-parameter is not changed when the method returns error.
+ */
+ static result Parse(const String& s, int radix, long& ret);
+
+ /**
+ * Gets the @c signed @c char equivalent of the current instance of the %Long class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c char equivalent of the current instance
+ */
+ virtual char ToChar(void) const;
+
+ /**
+ * Gets the @c signed @c short equivalent of the current instance of the %Long class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c short equivalent of the current instance
+ */
+ virtual short ToShort(void) const;
+
+ /**
+ * Gets the @c signed @c int equivalent of the current instance of the %Long class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c int equivalent of the current instance
+ */
+ virtual int ToInt(void) const;
+
+ /**
+ * Gets the @c signed @c long equivalent of the current instance of the %Long class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c long equivalent of the current instance
+ */
+ virtual long ToLong(void) const;
+
+ /**
+ * Gets the @c signed @c long @c long equivalent of the current instance of the %Long class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c long @c long equivalent of the current instance
+ */
+ virtual long long ToLongLong(void) const;
+
+ /**
+ * Gets the @c signed @c float equivalent of the current instance of the %Long class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c float equivalent of the current instance
+ */
+ virtual float ToFloat(void) const;
+
+ /**
+ * Gets the @c signed @c double equivalent of the current instance of the %Long class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c double equivalent of the current instance
+ */
+ virtual double ToDouble(void) const;
+
+ /**
+ * Gets the string representing the value of the current instance of the %Long class.
+ *
+ * @since 2.0
+ *
+ * @return The string representing the value of the current instance
+ */
+ virtual String ToString(void) const;
+
+ /**
+ * Gets the string representing the specified @c signed @c long value.
+ *
+ * @since 2.0
+ *
+ * @return The string containing a Unicode representation of the specified @c signed @c long value
+ * @param[in] value A @c signed @c long value to convert
+ */
+ static String ToString(long value);
+
+ /**
+ * A constant holding the maximum value a @c short can have; 2^31-1.
+ *
+ * @since 2.0
+ */
+ static const long VALUE_MAX = (long) 0x7FFFFFFF;
+
+ /**
+ * A constant holding the minimum value a @c short can have; -2^31.
+ *
+ * @since 2.0
+ */
+ static const long VALUE_MIN = (long) 0x80000000;
+
+ /**
+ * A @c long value of this instance.
+ *
+ * @since 2.0
+ */
+ long value;
+
+
+private:
+ friend class _LongImpl;
+ class _LongImpl * __pLongImpl;
+
+}; // Long
+
+}} // Tizen::Base
+
+#endif //_FBASE_LONG_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseLongComparer.h
+ * @brief This is the header file for the %LongComparer class.
+ *
+ * @see Long and Tizen::Base::Collection::IComparer
+ *
+ * This header file contains the declarations of the %LongComparer class.
+ */
+#ifndef _FBASE_LONG_COMPARER_H_
+#define _FBASE_LONG_COMPARER_H_
+
+#include <FBaseTypes.h>
+#include <FBaseObject.h>
+#include <FBaseColIComparer.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class LongComparer
+ * @brief This class checks for equivalence between 2 instances of the Long type.
+ *
+ * @since 2.0
+ *
+ * The %LongComparer class checks for equivalence between 2 instances of the Long type.
+ *
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/collection_comparison.htm">Collection Comparisons</a>.
+ *
+ * The following example demonstrates how to use the %LongComparer class.
+ *
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * void
+ * MyClass::LongComparerSample(void)
+ * {
+ * Long l1(123);
+ * Long l2(124);
+ * LongComparer comparer;
+ *
+ * int cmp;
+ * comparer.Compare(l1, l2, cmp);
+ * if (cmp < 0)
+ * {
+ * // ...
+ * }
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ LongComparer
+ : public Object
+ , public virtual Tizen::Base::Collection::IComparer
+{
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.0
+ */
+ LongComparer(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~LongComparer(void);
+
+ /**
+ * Compares two given instances of type Long.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] obj1 The first instance of type %Long
+ * @param[in] obj2 The second instance of type %Long
+ * @param[out] cmp The result of comparison
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified object instances are not of the expected type.
+ * @remarks The value of @c cmp can be:
+ *
+ * @code
+ * < 0 if the value of @c obj1 is less than the value of @c obj2
+ * == 0 if the value of @c obj1 is equal to the value of @c obj2
+ * > 0 if the value of @c obj1 is greater than the value of @c obj2
+ * @endcode
+ */
+ virtual result Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const;
+
+
+private:
+ /**
+ * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ LongComparer(const LongComparer& obj);
+
+ /**
+ * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ LongComparer& operator =(const LongComparer& rhs);
+
+ friend class _LongComparerImpl;
+ class _LongComparerImpl * __pLongComparerImpl;
+
+}; // LongComparer
+
+}} // Tizen::Base
+
+#endif // _FBASE_LONG_COMPARER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseLongLong.h
+ * @brief This is the header file for the %LongLong class.
+ *
+ * @see Tizen::Base::Number
+ *
+ * This header file contains the declarations of the %LongLong class.
+ */
+#ifndef _FBASE_LONG_LONG_H_
+#define _FBASE_LONG_LONG_H_
+
+#include <FBaseNumber.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class LongLong
+ * @brief This class is the wrapper class for the @c signed @c long @c long built-in type.
+ *
+ * @since 2.0
+ *
+ * The %LongLong class represents an integer value ranging from -9223372036854775808 to 9223372036854775807
+ * , that is, -(2^63) to +((2^63)-1). The class is useful when passing a 64-bit @c signed
+ * integral value to a method that accepts only an instance of Object. Furthermore,
+ * this class provides methods for converting %LongLong (and @c long @c long) to String, and %String
+ * to %LongLong (and @c long @c long).
+ *
+ * The following example demonstrates how to use the %LongLong class.
+ *
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * // This method checks whether the given string object contains a string
+ * // representation of the pre-defined minimum 64-bit integral value
+ * result
+ * MyClass::Verify(String& string, bool& out)
+ * {
+ * static const LongLong MINIMUM(123456789);
+ * result r = E_SUCCESS;
+ *
+ * long long l;
+ * r = LongLong::Parse(string, l);
+ * if (IsFailed(r))
+ * {
+ * goto CATCH;
+ * }
+ *
+ * out = (MINIMUM.CompareTo(l) == 0) ? true: false;
+ *
+ * return r;
+ * CATCH:
+ * return r;
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ LongLong
+ : public Number
+{
+public:
+ /**
+ * Initializes this instance of %LongLong with the specified value.
+ *
+ * @since 2.0
+ *
+ * @param[in] value A @c long @c long value
+ */
+ LongLong(long long value = 0);
+
+ /**
+ * Copying of objects using this copy constructor is allowed.
+ *
+ * @since 2.0
+ *
+ * @param[in] value An instance of %LongLong
+ */
+ LongLong(const LongLong& value);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~LongLong(void);
+
+ /**
+ * Copying of objects using this copy assignment operator is allowed.
+ *
+ * @since 2.0
+ *
+ * @param[in] rhs An instance of %LongLong
+ */
+ LongLong& operator =(const LongLong& rhs);
+
+ /**
+ * Compares two @c long @c long values.
+ *
+ * @since 2.0
+ *
+ * @return A 32-bit @c signed integer value
+ * @code
+ * < 0 if the value of @c l1 is less than the value of @c l2
+ * == 0 if the value of @c l1 is equal to the value of @c l2
+ * > 0 if the value of @c l1 is greater than the value of @c l2
+ * @endcode
+ * @param[in] l1 The first @c long @c long value to compare
+ * @param[in] l2 The second @c long @c long value to compare
+ */
+ static int Compare(long long l1, long long l2);
+
+ /**
+ * Compares the value of the current instance with the value of the specified instance of the %LongLong class.
+ *
+ * @since 2.0
+ *
+ * @return A 32-bit @c signed integer value
+ * @code
+ * < 0 if the value of the current instance is less than the value of the specified instance
+ * == 0 if the value of the current instance is equal to the value of the specified instance
+ * > 0 if the value of the current instance is greater than the value of the specified instance
+ * @endcode
+ * @param[in] value An instance of the %LongLong class to compare
+ */
+ int CompareTo(const LongLong& value) const;
+
+ /**
+ * Checks whether the value of the specified instance of Object is equal to the value of the current instance of %LongLong.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the value of the specified instance of Object is equal to the value of the current instance of %LongLong, @n
+ * else @c false
+ * @param[in] obj An instance of Object to compare
+ * @see Tizen::Base::Object::Equals()
+ */
+ virtual bool Equals(const Object& obj) const;
+
+ /**
+ * Gets the hash value of the current instance of %LongLong.
+ *
+ * @since 2.0
+ *
+ * @return An integer value indicating the hash value of the current instance of %LongLong
+ * @remarks Two equal instances must return the same hash value. For better performance,
+ * the used hash function must generate a random distribution for all inputs. @n
+ * The default implementation of this method returns the value of the current instance.
+ */
+ virtual int GetHashCode(void) const;
+
+ /**
+ * Gets the hash value of the specified @c long @c long value.
+ *
+ * @since 2.0
+ *
+ * @return An integer value indicating the hash value of the specified @c long @c long value
+ * @param[in] val A @c long @c long value to get the hash value
+ */
+ static int GetHashCode(long long val);
+
+ /**
+ * Gets the @c signed @c char equivalent of the current instance of the %LongLong class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c char equivalent of the current instance
+ */
+ virtual char ToChar(void) const;
+
+ /**
+ * Gets the @c signed @c short equivalent of the current instance of the %LongLong class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c short equivalent of the current instance
+ */
+ virtual short ToShort(void) const;
+
+ /**
+ * Gets the @c signed @c int equivalent of the current instance of the %LongLong class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c int equivalent of the current instance
+ */
+ virtual int ToInt(void) const;
+
+ /**
+ * Gets the @c signed @c long equivalent of the current instance of the %LongLong class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c long equivalent of the current instance
+ */
+ virtual long ToLong(void) const;
+
+ /**
+ * Gets the @c signed @c float equivalent of the current instance of the %LongLong class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c float equivalent of the current instance
+ */
+ virtual float ToFloat(void) const;
+
+ /**
+ * Gets the @c signed @c double equivalent of the current instance of the %LongLong class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c double equivalent of the current instance
+ */
+ virtual double ToDouble(void) const;
+
+ /**
+ * Gets the @c signed @c long @c long equivalent of the current instance of the %LongLong class.
+ *
+ * @since 2.0
+ *
+ * @return The @c signed @c long @c long equivalent of the current instance
+ */
+ virtual long long ToLongLong(void) const;
+
+ /**
+ * Gets the string representing the value of the current instance of the %LongLong class.
+ *
+ * @since 2.0
+ *
+ * @return The string representing the value of the current instance
+ */
+ virtual String ToString(void) const;
+
+ /**
+ * Gets the string representing the specified @c signed @c long @c long value.
+ *
+ * @since 2.0
+ *
+ * @return The string containing a Unicode representation of the specified @c signed @c long @c long value
+ * @param[in] value A @c signed @c long @c long value to convert
+ */
+ static String ToString(long long value);
+
+ /**
+ * Parses the specified string representing a numeric value and
+ * returns the value as a @c signed @c long @c long (as out parameter).
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A string representing a numeric value
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @remarks
+ * - This method assumes that the string representing the numeric value uses a radix 10.
+ * - This method guarantees that the original value of out-parameter is not changed when the method returns error.
+ */
+ static result Parse(const String& s, long long& ret);
+
+ /**
+ * Parses the specified string representing a numeric value using the specified radix and
+ * returns the value as a @c signed @c long @c long (as out parameter).
+ *
+ * @since 2.1
+ *
+ * @return An error code
+ * @param[in] s A string representing a numeric value
+ * @param[in] radix The radix of the string representing a unmeric value @n
+ * It must be either 2, 8, 10 or 16.
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @exception E_OUT_OF_RANGE The specified @c radix is invalid.
+ * @remarks This method guarantees that the original value of out-parameter is not changed when the method returns error.
+ */
+ static result Parse(const String& s, int radix, long long& ret);
+
+ /**
+ * A constant holding the maximum value a @c long @c long can have; 2^63-1.
+ *
+ * @since 2.0
+ */
+ static const long long VALUE_MAX = (long long) 0x7FFFFFFFFFFFFFFFLL;
+
+ /**
+ * A constant holding the minimum value a @c long @c long can have; -2^63.
+ *
+ * @since 2.0
+ */
+ static const long long VALUE_MIN = (long long) 0x8000000000000000LL;
+
+ /**
+ * A @c long @c long value of this instance.
+ *
+ * @since 2.0
+ */
+ long long value;
+
+
+private:
+ friend class _LongLongImpl;
+ class _LongLongImpl * __pLongLongImpl;
+
+}; // LongLong
+
+}} // Tizen::Base
+
+#endif //_FBASE_LONG_LONG_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseLongLongComparer.h
+ * @brief This is the header file for the %LongLongComparer class.
+ *
+ * @see Long and Tizen::Base::Collection::IComparer
+ *
+ * This header file contains the declarations of the %LongLongComparer class.
+ */
+#ifndef _FBASE_LONG_LONG_COMPARER_H_
+#define _FBASE_LONG_LONG_COMPARER_H_
+
+#include <FBaseTypes.h>
+#include <FBaseObject.h>
+#include <FBaseColIComparer.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class LongLongComparer
+ * @brief This class checks for equivalence between 2 instances of the LongLong type.
+ *
+ * @since 2.0
+ *
+ * The %LongLongComparer class checks for equivalence between 2 instances of the %LongLong type.
+ *
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/collection_comparison.htm">Collection Comparisons</a>.
+ *
+ * The following example demonstrates how to use the %LongComparer class.
+ *
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * void
+ * MyClass::LongLongComparerSample(void)
+ * {
+ * LongLong ll1(123);
+ * LongLong ll2(124);
+ * LongLongComparer comparer;
+ *
+ * int cmp;
+ * comparer.Compare(ll1, ll2, cmp);
+ * if (cmp < 0)
+ * {
+ * // ...
+ * }
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ LongLongComparer
+ : public Object
+ , public virtual Tizen::Base::Collection::IComparer
+{
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.0
+ */
+ LongLongComparer(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~LongLongComparer(void);
+
+ /**
+ * Compares two given instances of type LongLong.
+ *
+ * @since 2.0
+ * @return An error code
+ * @param[in] obj1 The first instance of type LongLong
+ * @param[in] obj2 The second instance of type LongLong
+ * @param[out] cmp The result of comparison
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified object instances are not of the expected type.
+ * @remarks The value of @c cmp can be:
+ *
+ * @code
+ * < 0 if the value of @c obj1 is less than the value of @c obj2
+ * == 0 if the value of @c obj1 is equal to the value of @c obj2
+ * > 0 if the value of @c obj1 is greater than the value of @c obj2
+ * @endcode
+ */
+ virtual result Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const;
+
+
+private:
+ /**
+ * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ LongLongComparer(const LongLongComparer& obj);
+
+ /**
+ * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ LongLongComparer& operator =(const LongLongComparer& rhs);
+
+ friend class _LongLongComparerImpl;
+ class _LongLongComparerImpl * __pLongLongComparerImpl;
+
+}; // LongLongComparer
+
+}} // Tizen::Base
+
+#endif // _FBASE_LONG_LONG_COMPARER_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseShort.h
+ * @brief This is the header file for the %Short class.
+ *
+ * @see Number()
+ *
+ * This header file contains the declarations of the %Short class.
+ */
+#ifndef _FBASE_SHORT_H_
+#define _FBASE_SHORT_H_
+
+#include <FBaseNumber.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class Short
+ * @brief This class is the wrapper class for the @c signed @c short built-in type.
+ *
+ * @since 2.0
+ *
+ * The %Short class represents an integer value ranging from -32768 to 32767. The class is useful when passing
+ * a 16-bit @c signed integral value to a method that accepts only an instance of Object. Furthermore,
+ * this class provides methods for converting a %Short (and @c short) to a String, and a %String to %Short
+ * (and @c short).
+ *
+ * The following example demonstrates how to use the %Short class.
+ *
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * // This method checks whether the given string object contains a string
+ * // representation of the pre-defined minimum 16-bit integral value
+ * result
+ * MyClass::Verify(String& string, bool& out)
+ * {
+ * static const Short MINIMUM(1230);
+ *
+ * result r = E_SUCCESS;
+ *
+ * short s;
+ * r = Short::Parse(string, s)
+ * if (IsFailed(r))
+ * {
+ * goto CATCH;
+ * }
+ *
+ * out = (MINIMUM.Compare(s) == 0) ? true: false;
+ *
+ * return r;
+ * CATCH:
+ * return r;
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ Short
+ : public Number
+{
+public:
+ /**
+ * Initializes this instance of %Short with the specified @c value.
+ *
+ * @since 2.0
+ *
+ * @param[in] value A @c short value
+ */
+ Short(short value = 0);
+
+ /**
+ * This is the copy constructor for the %Short class.
+ *
+ * @since 2.0
+ *
+ * @param[in] value An instance of %Short
+ */
+ Short(const Short& value);
+
+ /**
+ * This is the destructor for this class.
+ *
+ * @since 2.0
+ */
+ virtual ~Short(void);
+
+ /**
+ * Assigns the value of the specified instance to the current instance of %Short.
+ *
+ * @since 2.0
+ *
+ * @param[in] rhs An instance of %Short
+ */
+ Short& operator =(const Short& rhs);
+
+ /**
+ * Compares the specified @c short values.
+ *
+ * @since 2.0
+ *
+ * @return A 32-bit @c signed @c integer value
+ * @param[in] s1 The first @c short value to compare
+ * @param[in] s2 The second @c short value to compare
+ *
+ * @code
+ * < 0 if @c s1 is less than @c s2
+ * == 0 if @c s1 is equal to @c s2
+ * > 0 if @c s1 is greater than @c s2
+ * @endcode
+ */
+ static int Compare(short s1, short s2);
+
+ /**
+ * Compares the value of the current instance of the %Short class
+ * with the value of the specified instance of the %Short class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed 32-bit @c integer value
+ * @param[in] value An instance of the %Short class to compare
+ *
+ * @code
+ * < 0 if the value of the current instance is less than that of the specified instance
+ * == 0 if the value of the current instance is equal to that of the specified instance
+ * > 0 if the value of the current instance is greater than that of the specified instance
+ * @endcode
+ */
+ int CompareTo(const Short& value) const;
+
+ /**
+ * Checks whether the value of the specified instance of Object is equal to the value of the current instance of %Short.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the value of the specified instance of Object is equal to the value of the current instance of %Short, @n
+ * else @c false
+ * @param[in] obj An instance of Object to compare
+ * @remarks The method returns @c false if the specified object is not of the
+ * type @c short.
+ * @see Tizen::Base::Object::Equals()
+ */
+ virtual bool Equals(const Object& obj) const;
+
+
+ /**
+ * Checks whether the value of the current instance is equal to the specified @c short value.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the value of the current instance is equal to the specified @c short value, @n
+ * else @c false
+ * @param[in] value A @c short value to compare
+ */
+ bool Equals(short value) const;
+
+ /**
+ * Gets the hash value of the current instance of %Short.
+ *
+ * @since 2.0
+ *
+ * @return An integer value indicating the hash value of the current instance of %Short
+ * @remarks Two equal instances must return the same hash value. For better performance,
+ * the used hash function must generate a random distribution for all inputs. @n
+ * The default implementation of this method returns the value of the current instance.
+ */
+ virtual int GetHashCode(void) const;
+
+ /**
+ * Gets the hash value of the specified @c short value.
+ *
+ * @since 2.0
+ *
+ * @return An integer value indicating the hash value of the specified @c short value
+ * @param[in] val A @c short value to get the hash value
+ */
+ static int GetHashCode(short val);
+
+ /**
+ * Decodes a string into a @c signed @c short.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A numeric value
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @remarks This method accepts decimal, hexadecimal, and octal numbers given by the
+ * following grammar:
+ *
+ * @code
+ * - DecodableString:
+ * Sign[opt] DecimalNumeral
+ * Sign[opt] 0x HexDigits
+ * Sign[opt] 0X HexDigits
+ * Sign[opt] # HexDigits
+ * Sign[opt] 0 OctalDigits
+ * - Sign:
+ * '-'
+ * @endcode
+ */
+ static result Decode(const String& s, short& ret);
+
+ /**
+ * Parses the specified string representing a numeric value and
+ * returns the value as @c signed @c short.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A string representing a numeric value
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @remarks
+ * - This method assumes that the string representing the numeric value uses a radix 10.
+ * - This method guarantees that the original value of out-parameter is not changed when the method returns error.
+ */
+ static result Parse(const String& s, short& ret);
+
+ /**
+ * Parses the specified string representing a numeric value
+ * using the specified radix and returns the value as @c signed @c short.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A string representing a numeric value
+ * @param[in] radix The radix of the string representing a numeric value @n
+ * It must either be @c 2, @c 8, @c 10, or @c 16.
+ * @param[out] ret The result of the operation
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_NUM_FORMAT The specified string does not contain a number that can be parsed.
+ * @exception E_OUT_OF_RANGE The specified @c radix is invalid.
+ * @remarks This method guarantees that the original value of out-parameter is not changed when the method returns error.
+ */
+ static result Parse(const String& s, int radix, short& ret);
+
+ /**
+ * Gets the @c signed @c char equivalent of the current instance of the %Short class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c char equivalent of the current instance
+ */
+ virtual char ToChar(void) const;
+
+ /**
+ * Gets the @c signed @c short equivalent of the current instance of the %Short class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c short equivalent of the current instance
+ */
+ virtual short ToShort(void) const;
+
+ /**
+ * Gets the @c signed @c int equivalent of the current instance of the %Short class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c int equivalent of the current instance
+ */
+ virtual int ToInt(void) const;
+
+ /**
+ * Gets the @c signed @c long equivalent of the current instance of the %Short class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c long equivalent of the current instance
+ */
+ virtual long ToLong(void) const;
+
+ /**
+ * Gets the @c signed @c long @c long equivalent of the current instance of the %Short class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c long @c long equivalent of the current instance
+ */
+ virtual long long ToLongLong(void) const;
+
+ /**
+ * Gets the @c signed @c float equivalent of the current instance of the %Short class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c float equivalent of the current instance
+ */
+ virtual float ToFloat(void) const;
+
+ /**
+ * Gets the @c signed @c double equivalent of the current instance of the %Short class.
+ *
+ * @since 2.0
+ *
+ * @return A @c signed @c double equivalent of the current instance
+ */
+ virtual double ToDouble(void) const;
+
+ /**
+ * Gets the string representing the value of the current instance of the %Short class.
+ *
+ * @since 2.0
+ *
+ * @return A string representing the value of the current instance
+ */
+ virtual String ToString(void) const;
+
+ /**
+ * Gets the string representing the specified @c signed @c short value.
+ *
+ * @since 2.0
+ *
+ * @return A string containing a Unicode representation of the specified @c signed @c short value
+ * @param[in] value A @c signed @c short value to convert
+ */
+ static String ToString(short value);
+
+ /**
+ * A constant holding the maximum value a @c short will be equal to 2^15-1.
+ *
+ * @since 2.0
+ */
+ static const short VALUE_MAX = (short) 0x7FFF;
+
+ /**
+ * A constant holding the minimum value a @c short will be equal to -2^15.
+ *
+ * @since 2.0
+ */
+ static const short VALUE_MIN = (short) 0x8000;
+
+ /**
+ * A @c short value of this instance.
+ *
+ * @since 2.0
+ */
+ short value;
+
+
+private:
+ friend class _ShortImpl;
+ class _ShortImpl * __pShortImpl;
+
+}; // Short
+
+}} // Tizen::Base
+
+#endif //_FBASE_SHORT_H_
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FBaseShortComparer.h
+ * @brief This is the header file for the %ShortComparer class.
+ *
+ * @see Short
+ * @see Tizen::Base::Collection::IComparer
+ *
+ * This header file contains the declarations of the %ShortComparer class.
+ */
+#ifndef _FBASE_SHORT_COMPARER_H_
+#define _FBASE_SHORT_COMPARER_H_
+
+#include <FBaseTypes.h>
+#include <FBaseObject.h>
+#include <FBaseColIComparer.h>
+
+
+namespace Tizen { namespace Base
+{
+/**
+ * @class ShortComparer
+ * @brief This class compares 2 instances of the Short type for equivalence.
+ *
+ * @since 2.0
+ *
+ * The %ShortComparer class compares 2 instances of the Short type for equivalence.
+ *
+ * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/base/collection_comparison.htm">Collection Comparisons</a>.
+ *
+ * The following example demonstrates how to use the %ShortComparer class.
+ *
+ * @code
+ *
+ * #include <FBase.h>
+ *
+ * using namespace Tizen::Base;
+ *
+ * void
+ * MyClass::ShortComparerSample(void)
+ * {
+ * Short s1(123);
+ * Short s2(124);
+ * ShortComparer comparer;
+ *
+ * int cmp;
+ * comparer.Compare(s1, s2, cmp);
+ * if (cmp < 0)
+ * {
+ * // ...
+ * }
+ * }
+ * @endcode
+ */
+class _OSP_EXPORT_ ShortComparer
+ : public Object
+ , public virtual Tizen::Base::Collection::IComparer
+{
+public:
+ /**
+ * This is the default constructor for this class.
+ *
+ * @since 2.0
+ */
+ ShortComparer(void);
+
+ /**
+ * This destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ */
+ virtual ~ShortComparer(void);
+
+ /**
+ * Compares two given instances of type Short.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] obj1 An object of Short to compare
+ * @param[in] obj2 An object of Short to compare
+ * @param[out] cmp The result of comparison
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified object instances are not of the expected type.
+ * @remarks The value of @c cmp can be:
+ *
+ * @code
+ * < 0 if the value of @c obj1 is less than the value of @c obj2
+ * == 0 if the value of @c obj1 is equal to the value of @c obj2
+ * > 0 if the value of @c obj1 is greater than the value of @c obj2
+ * @endcode
+ */
+ virtual result Compare(const Tizen::Base::Object& obj1, const Tizen::Base::Object& obj2, int& cmp) const;
+
+
+private:
+ /**
+ * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ ShortComparer(const ShortComparer& obj);
+
+ /**
+ * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
+ */
+ ShortComparer& operator =(const ShortComparer& rhs);
+
+ friend class _ShortComparerImpl;
+ class _ShortComparerImpl * __pShortComparerImpl;
+
+}; // ShortComparer
+
+}} // Tizen::Base
+
+#endif // _FBASE_SHORT_COMPARER_H_
//
+// Open Service Platform
// Copyright (c) 2012 Samsung Electronics Co., Ltd.
//
// Licensed under the Apache License, Version 2.0 (the License);
: public Object
{
public:
- /**
- * This is the default constructor for this class. @n
- * It creates an empty %String instance with the default capacity of @c 16 bytes.
- *
- * @since 2.0
- */
- String(void);
-
- /**
- * Initializes this instance of %String with the specified capacity.
- *
- * @since 2.0
- *
- * @param[in] capacity The default capacity of this instance
- */
- String(int capacity);
-
- /**
- * Initializes this instance of %String with the specified Unicode character.
- *
- * @since 2.0
- *
- * @param[in] ch A Unicode character
- */
- String(wchar_t ch);
-
- /**
- * Initializes this instance of %String with the specified Unicode string.
- *
- * @since 2.0
- *
- * @param[in] pValue A pointer to an array of Unicode characters
- */
- String(const wchar_t* pValue);
-
- /**
- * Initializes this instance of %String with the specified character string.
- *
- * @since 2.0
- *
- * @param[in] pValue A pointer to an array of UTF-8 characters
- */
- String(const char* pValue);
-
- /**
- * Copying of objects using this copy constructor is allowed.
- *
- * @since 2.0
- *
- * @param[in] value An instance of %String
- */
- String(const String& value);
-
- /**
- * TThis destructor overrides Tizen::Base::Object::~Object().
- *
- * @since 2.0
- *
- * @remarks The internally allocated memory block is freed when the instance is destroyed.
- */
- virtual ~String(void);
-
- /**
- * Returns the Unicode character at the specified @c index.
- *
- * @since 2.0
- *
- * @return A const reference to the Unicode character
- * @param[in] index An index within the current instance of %String
- */
+ /**
+ * This is the default constructor for this class. @n
+ * It creates an empty %String instance with the default capacity of @c 16 bytes.
+ *
+ * @since 2.0
+ */
+ String(void);
+
+ /**
+ * Initializes this instance of %String with the specified capacity.
+ *
+ * @since 2.0
+ *
+ * @param[in] capacity The default capacity of this instance
+ */
+ String(int capacity);
+
+ /**
+ * Initializes this instance of %String with the specified Unicode character.
+ *
+ * @since 2.0
+ *
+ * @param[in] ch A Unicode character
+ */
+ String(const wchar_t ch);
+
+ /**
+ * Initializes this instance of %String with the specified Unicode string.
+ *
+ * @since 2.0
+ *
+ * @param[in] pValue A pointer to an array of Unicode characters
+ */
+ String(const wchar_t* pValue);
+
+ /**
+ * Initializes this instance of %String with the specified character string.
+ *
+ * @since 2.0
+ *
+ * @param[in] pValue A pointer to an array of UTF-8 characters
+ */
+ String(const char* pValue);
+
+ /**
+ * Copying of objects using this copy constructor is allowed.
+ *
+ * @since 2.0
+ *
+ * @param[in] value An instance of %String
+ */
+ String(const String& value);
+
+ /**
+ * TThis destructor overrides Tizen::Base::Object::~Object().
+ *
+ * @since 2.0
+ *
+ * @remarks The internally allocated memory block is freed when the instance is destroyed.
+ */
+ virtual ~String(void);
+
+ /**
+ * Returns the Unicode character at the specified @c index.
+ *
+ * @since 2.0
+ *
+ * @return A const reference to the Unicode character
+ * @param[in] index An index within the current instance of %String
+ */
const wchar_t& operator [](int index) const;
- /**
- * Returns a reference to the Unicode character at the specified @c index.
- *
- * @since 2.0
- *
- * @return A reference to the Unicode character
- * @param[in] index An index within the current instance of %String
- */
- wchar_t& operator [](int index);
-
- /**
- * Copies the text from the specified
- * Unicode string to the calling instance of %String.
- *
- * @since 2.0
- *
- * @return A reference to the %String instance
- * @param[in] pRhs A pointer to an array of Unicode characters
- */
- String& operator =(const wchar_t* pRhs);
-
- /**
- * Copying of objects using this copy assignment operator is allowed.
- *
- * @since 2.0
- *
- * @return A reference to the %String instance
- * @param[in] rhs An instance of %String
- */
- String& operator =(const String& rhs);
-#ifdef TEST
- /**
- * Appends the text from the specified array of Unicode characters
- * to the calling instance of %String.
- *
- * @since 2.0
- *
- * @return A reference to the %String instance
- * @param[in] pRhs A pointer to an array of Unicode characters
- */
- String& operator +=(const wchar_t* pRhs);
-
- /**
- * Appends the text from the specified instance of %String
- * to the calling instance of %String.
- *
- * @since 2.0
- *
- * @return A reference to the %String instance
- * @param[in] rhs An instance of %String to copy
- */
- String& operator +=(const String& rhs);
-
- /**
- * Concatenates the two strings.
- *
- * @since 2.0
- *
- * @return The concatenated %String instance
- * @param[in] lhs A reference to the %String instance on the left-hand side of the operator
- * @param[in] rhs A reference to the %String instance on the right-hand side of the operator
- */
- _OSP_EXPORT_ friend String operator +(const String& lhs, const String& rhs);
-#endif
- /**
- * Checks the two strings for equality.
- *
- * @since 2.0
- *
- * @return @c true if the text of the specified %String instance equals the calling instance's text, @n
- * else @c false
- * @param[in] rhs A reference to the %String instance on the right-hand side of the operator
- * @remarks The operator performs an ordinal comparison of each Unicode character.
- */
- bool operator ==(const String& rhs) const;
-
- /**
- * Checks the two strings for inequality.
- *
- * @since 2.0
- *
- * @return @c true if the text of the specified %String instance is not equal to the calling instance's text, @n
- * else @c false
- * @param[in] rhs A reference to the %String instance on the right-hand side of the operator
- * @remarks The operator performs an ordinal comparison of each Unicode character.
- */
- bool operator !=(const String& rhs) const;
-
- /**
- * Checks whether the string is empty.
- *
- * @since 2.0
- *
- * @return @c true if the current instance is a zero-length %String instance L"", @n
- * else @c false
- */
+ /**
+ * Returns a reference to the Unicode character at the specified @c index.
+ *
+ * @since 2.0
+ *
+ * @return A reference to the Unicode character
+ * @param[in] index An index within the current instance of %String
+ */
+ wchar_t& operator [](int index);
+
+ /**
+ * Copies the text from the specified
+ * Unicode string to the calling instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return A reference to the %String instance
+ * @param[in] pRhs A pointer to an array of Unicode characters
+ */
+ String& operator =(const wchar_t* pRhs);
+
+ /**
+ * Copying of objects using this copy assignment operator is allowed.
+ *
+ * @since 2.0
+ *
+ * @return A reference to the %String instance
+ * @param[in] rhs An instance of %String
+ */
+ String& operator =(const String& rhs);
+
+ /**
+ * Appends the text from the specified array of Unicode characters
+ * to the calling instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return A reference to the %String instance
+ * @param[in] pRhs A pointer to an array of Unicode characters
+ */
+ String& operator +=(const wchar_t* pRhs);
+
+ /**
+ * Appends the text from the specified instance of %String
+ * to the calling instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return A reference to the %String instance
+ * @param[in] rhs An instance of %String to copy
+ */
+ String& operator +=(const String& rhs);
+
+ /**
+ * Concatenates the two strings.
+ *
+ * @since 2.0
+ *
+ * @return The concatenated %String instance
+ * @param[in] lhs A reference to the %String instance on the left-hand side of the operator
+ * @param[in] rhs A reference to the %String instance on the right-hand side of the operator
+ */
+ _OSP_EXPORT_ friend String operator +(const String& lhs, const String& rhs);
+
+ /**
+ * Checks the two strings for equality.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the text of the specified %String instance equals the calling instance's text, @n
+ * else @c false
+ * @param[in] rhs A reference to the %String instance on the right-hand side of the operator
+ * @remarks The operator performs an ordinal comparison of each Unicode character.
+ */
+ bool operator ==(const String& rhs) const;
+
+ /**
+ * Checks the two strings for inequality.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the text of the specified %String instance is not equal to the calling instance's text, @n
+ * else @c false
+ * @param[in] rhs A reference to the %String instance on the right-hand side of the operator
+ * @remarks The operator performs an ordinal comparison of each Unicode character.
+ */
+ bool operator !=(const String& rhs) const;
+
+ /**
+ * Checks whether the string is empty.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the current instance is a zero-length %String instance L"", @n
+ * else @c false
+ */
bool IsEmpty(void) const;
- /**
- * Appends the specified @c wchar_t value to this %String instance after converting it.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] ch A @c wchar_t value to insert
- * @exception E_SUCCESS The method is successful.
- */
- result Append(wchar_t ch);
+ /**
+ * Appends the specified @c wchar_t value to this %String instance after converting it.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] ch A @c wchar_t value to insert
+ * @exception E_SUCCESS The method is successful.
+ */
+ result Append(wchar_t ch);
+
+ /**
+ * Appends the specified @c char value to this %String instance after converting it.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] ch A @c char value to insert
+ * @exception E_SUCCESS The method is successful.
+ */
+ result Append(char ch);
+
+ /**
+ * Appends the string representing the specified 32-bit @c int value to this
+ * instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] i A 32-bit integer value to insert
+ * @exception E_SUCCESS The method is successful.
+ */
+ result Append(int i);
+
+ /**
+ * Appends the string representing the specified @c short value to this
+ * instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A @c short value to insert
+ * @exception E_SUCCESS The method is successful.
+ */
+ result Append(short s);
+
+ /**
+ * Appends the string representing the specified @c long value to this
+ * instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] l A @c long value to insert
+ * @exception E_SUCCESS The method is successful.
+ */
+ result Append(long l);
+
+ /**
+ * Appends the string representing the specified @c long @c long value to this
+ * instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] ll A @c long @c long value to insert
+ * @exception E_SUCCESS The method is successful.
+ */
+ result Append(long long ll);
+
+ /**
+ * Appends the string representing the specified @c float value to this
+ * instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] f A @c float value to insert
+ * @exception E_SUCCESS The method is successful.
+ */
+ result Append(float f);
+
+ /**
+ * Appends the string representing the specified @c double value to this
+ * instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] d A @c double value to insert
+ * @exception E_SUCCESS The method is successful.
+ */
+ result Append(double d);
/**
* Appends the specified null-terminated Unicode text to this instance
* @exception E_INVALID_ARG A @c null pointer is passed.
*/
result Append(const wchar_t* p);
-#ifdef TEST
- /**
- * Appends the specified @c char value to this %String instance after converting it.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] ch A @c char value to insert
- * @exception E_SUCCESS The method is successful.
- */
- result Append(char ch);
-
- /**
- * Appends the string representing the specified 32-bit @c int value to this
- * instance of %String.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] i A 32-bit integer value to insert
- * @exception E_SUCCESS The method is successful.
- */
- result Append(int i);
-
- /**
- * Appends the string representing the specified @c short value to this
- * instance of %String.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] s A @c short value to insert
- * @exception E_SUCCESS The method is successful.
- */
- result Append(short s);
-
- /**
- * Appends the string representing the specified @c long value to this
- * instance of %String.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] l A @c long value to insert
- * @exception E_SUCCESS The method is successful.
- */
- result Append(long l);
-
- /**
- * Appends the string representing the specified @c long @c long value to this
- * instance of %String.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] ll A @c long @c long value to insert
- * @exception E_SUCCESS The method is successful.
- */
- result Append(long long ll);
-
- /**
- * Appends the string representing the specified @c float value to this
- * instance of %String.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] f A @c float value to insert
- * @exception E_SUCCESS The method is successful.
- */
- result Append(float f);
-
- /**
- * Appends the string representing the specified @c double value to this
- * instance of %String.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] d A @c double value to insert
- * @exception E_SUCCESS The method is successful.
- */
- result Append(double d);
- /**
- * Appends the specified instance of %String to this instance
- * of %String.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] str An instance of %String to append
- * @exception E_SUCCESS The method is successful.
- */
- result Append(const String& str);
-#endif
- /**
- * Clears the current instance and sets it to an empty %String instance. @n
- * The capacity is set to @c 16 bytes, which is the default capacity.
- *
- * @since 2.0
- */
- void Clear(void);
-
- /**
- * Compares the values of the two strings.
- *
- * @since 2.0
- *
- * @return A 32-bit @c signed integer value
- * @param[in] str0 The first %String instance to compare
- * @param[in] str1 The second %String instance to compare
- * @remarks This method performs an ordinal comparison of each Unicode
- * character contained in the two given %String instances.
- * For instance, "U+xxx" is greater than "U+XXX", but smaller than "U+yyy".
- *
- * @code
- * < 0 if the value of the first instance is less than the value of the second instance
- * == 0 if the value of the first instance is equal to the value of the second instance
- * > 0 if the value of the first instance is greater than the value of the second instance
- * @endcode
- */
- static int Compare(const String& str0, const String& str1);
-
- /**
- * Compares the value of the current instance to the value of the specified instance
- * of %String.
- *
- * @since 2.0
- *
- * @return A 32-bit @c signed integer value
- *@code
- * < 0 if the value of the current instance is less than the value of the specified %String instance
- * == 0 if the value of the current instance is equal to the value of the specified %String instance
- * > 0 if the value of the current instance is greater than the value of the specified %String instance
- *@endcode
- * @param[in] str An instance of %String to compare
- * @remarks This method performs an ordinal comparison of each Unicode character. For instance,
- * L"U+xxx" is greater than L"U+XXX", but smaller than L"U+yyy".
- */
- int CompareTo(const String& str) const;
-
- /**
- * Ensures that the specified length is less than or equal to the capacity of
- * the current instance of %String. @n
- * Otherwise, it expands the capacity of the internal buffer to a value that is greater than or equal to the specified length.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] minLength A minimum length to ensure
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified @c minLength is negative.
- */
- result EnsureCapacity(int minLength);
-
- /**
- * Checks whether the value of the specified instance of Object is equal to the value of the current instance of %String.
- *
- * @since 2.0
- *
- * @return @c true if the value of the specified instance of Object is equal to the value of the current instance of %String, @n
- * else @c false
- * @param[in] obj An instance of Object to compare
- * @remarks This method returns @c false if the specified @c obj is not a string.
- * @see Object::Equals()
- */
+ /**
+ * Appends the specified instance of %String to this instance
+ * of %String.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] str An instance of %String to append
+ * @exception E_SUCCESS The method is successful.
+ */
+ result Append(const String& str);
+
+ /**
+ * Clears the current instance and sets it to an empty %String instance. @n
+ * The capacity is set to @c 16 bytes, which is the default capacity.
+ *
+ * @since 2.0
+ */
+ void Clear(void);
+
+ /**
+ * Compares the values of the two strings.
+ *
+ * @since 2.0
+ *
+ * @return A 32-bit @c signed integer value
+ * @param[in] str0 The first %String instance to compare
+ * @param[in] str1 The second %String instance to compare
+ * @remarks This method performs an ordinal comparison of each Unicode
+ * character contained in the two given %String instances.
+ * For instance, "U+xxx" is greater than "U+XXX", but smaller than "U+yyy".
+ *
+ * @code
+ * < 0 if the value of the first instance is less than the value of the second instance
+ * == 0 if the value of the first instance is equal to the value of the second instance
+ * > 0 if the value of the first instance is greater than the value of the second instance
+ * @endcode
+ */
+ static int Compare(const String& str0, const String& str1);
+
+ /**
+ * Compares the value of the current instance to the value of the specified instance
+ * of %String.
+ *
+ * @since 2.0
+ *
+ * @return A 32-bit @c signed integer value
+ *@code
+ * < 0 if the value of the current instance is less than the value of the specified %String instance
+ * == 0 if the value of the current instance is equal to the value of the specified %String instance
+ * > 0 if the value of the current instance is greater than the value of the specified %String instance
+ *@endcode
+ * @param[in] str An instance of %String to compare
+ * @remarks This method performs an ordinal comparison of each Unicode character. For instance,
+ * L"U+xxx" is greater than L"U+XXX", but smaller than L"U+yyy".
+ */
+ int CompareTo(const String& str) const;
+
+ /**
+ * Ensures that the specified length is less than or equal to the capacity of
+ * the current instance of %String. @n
+ * Otherwise, it expands the capacity of the internal buffer to a value that is greater than or equal to the specified length.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] minLength A minimum length to ensure
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c minLength is negative.
+ */
+ result EnsureCapacity(int minLength);
+
+ /**
+ * Checks whether the value of the specified instance of Object is equal to the value of the current instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the value of the specified instance of Object is equal to the value of the current instance of %String, @n
+ * else @c false
+ * @param[in] obj An instance of Object to compare
+ * @remarks This method returns @c false if the specified @c obj is not a string.
+ * @see Object::Equals()
+ */
virtual bool Equals(const Object& obj) const;
- /**
- * Checks whether the value of the specified instance is equal to the value of the current instance of %String. @n
- * Case sensitivity can be controlled.
- *
- * @since 2.0
- *
- * @return @c true if the values match, @n
- * else @c false
- * @param[in] str An instance of %String to compare with the
- * calling instance
- * @param[in] caseSensitive Set to @c true to perform a case sensitive ordinal comparison of the strings, @n
- * else @c false
- *
- * @remarks This method performs an ordinal comparison of each Unicode
- * character contained in the two given %String instances.
- */
- bool Equals(const String& str, bool caseSensitive) const;
-
- /**
- * Formats the inputs as per the specified format and sets the value of the calling instance to the resultant string.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] length The maximum number of wide characters to write, including the terminating @c null character
- * @param[in] pFormat The wide character format specifier
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified @c length is negative or @c pFormat is @c null.
- * @remarks If an "l" modifier is present in @c pFormat (for example, L"@%ls"), it is a pointer to an array of wide characters. @n
- * @remarks A pointer to an array of UTF-8 characters is not allowed in the Format() method (for example, Format(20, L"@%s", pUTF8Str)).
- * The following format specifiers are supported in this method:
- * @code
- * specifier Output
- * --------- ------
- * c single byte character
- * d(or i) signed decimal integer
- * u unsigned decimal integer
- * x unsigned hexadecimal integer
- * f decimal floating point
- * e scientific notation using e character
- * g use the shorter of %e or %f
- * s single byte character string
- * ls(or S) wide-character string
- * lld 64-bit signed decimal integer
- *
- * @endcode
- *
- * The following example demonstrates how to use the %Format() method.
- * @code
- *
- * String str;
- *
- * int value = 10;
- * wchar_t* testStr = L"TEST";
- *
- * str.Format(25, L"FORMAT %d %ls", value, testStr); // str == L"FORMAT 10 TEST"
- *
- * @endcode
- */
- result Format(int length, const wchar_t* pFormat, ...);
-
- /**
- * Gets the hash value of the current instance.
- *
- * @since 2.0
- *
- * @return The hash value of the current instance
- * @remarks Two equal instances must return the same hash value. For better performance,
- * the hash function used must generate a random distribution
- * for all inputs.
- */
- virtual int GetHashCode(void) const;
-
- /**
- * Gets the character at the specified position.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] indexAt The position of the character
- * @param[out] ch The character at the specified index
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
- */
+ /**
+ * Checks whether the value of the specified instance is equal to the value of the current instance of %String. @n
+ * Case sensitivity can be controlled.
+ *
+ * @since 2.0
+ *
+ * @return @c true if the values match, @n
+ * else @c false
+ * @param[in] str An instance of %String to compare with the
+ * calling instance
+ * @param[in] caseSensitive Set to @c true to perform a case sensitive ordinal comparison of the strings, @n
+ * else @c false
+ *
+ * @remarks This method performs an ordinal comparison of each Unicode
+ * character contained in the two given %String instances.
+ */
+ bool Equals(const String& str, bool caseSensitive) const;
+
+ /**
+ * Formats the inputs as per the specified format and sets the value of the calling instance to the resultant string.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] length The maximum number of wide characters to write, including the terminating @c null character
+ * @param[in] pFormat The wide character format specifier
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c length is negative or @c pFormat is @c null.
+ * @remarks If an "l" modifier is present in @c pFormat (for example, L"@%ls"), it is a pointer to an array of wide characters. @n
+ * @remarks A pointer to an array of UTF-8 characters is not allowed in the Format() method (for example, Format(20, L"@%s", pUTF8Str)).
+ * The following format specifiers are supported in this method:
+ * @code
+ * specifier Output
+ * --------- ------
+ * c single byte character
+ * d(or i) signed decimal integer
+ * u unsigned decimal integer
+ * x unsigned hexadecimal integer
+ * f decimal floating point
+ * e scientific notation using e character
+ * g use the shorter of %e or %f
+ * s single byte character string
+ * ls(or S) wide-character string
+ * lld 64-bit signed decimal integer
+ *
+ * @endcode
+ *
+ * The following example demonstrates how to use the %Format() method.
+ * @code
+ *
+ * String str;
+ *
+ * int value = 10;
+ * wchar_t* testStr = L"TEST";
+ *
+ * str.Format(25, L"FORMAT %d %ls", value, testStr); // str == L"FORMAT 10 TEST"
+ *
+ * @endcode
+ */
+ result Format(int length, const wchar_t* pFormat, ...);
+
+ /**
+ * Gets the hash value of the current instance.
+ *
+ * @since 2.0
+ *
+ * @return The hash value of the current instance
+ * @remarks Two equal instances must return the same hash value. For better performance,
+ * the hash function used must generate a random distribution
+ * for all inputs.
+ */
+ virtual int GetHashCode(void) const;
+
+ /**
+ * Gets the character at the specified position.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] indexAt The position of the character
+ * @param[out] ch The character at the specified index
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
+ */
result GetCharAt(int indexAt, wchar_t& ch) const;
- /**
- * Searches for a character in the calling instance. @n
- * Gets the index of the first character that matches to
- * the specified character in this instance.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] ch The Unicode character to locate
- * @param[in] startIndex The starting position of search
- * @param[out] indexOf The index of the character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OBJ_NOT_FOUND The specified character is not found.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result IndexOf(wchar_t ch, int startIndex, int& indexOf) const;
-
- /**
- * Searches for a specified substring in the calling instance. @n
- * Gets the starting index of the first occurrence of the specified substring.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] str An instance of %String to locate
- * @param[in] startIndex The starting position of the search
- * @param[out] indexOf The index of the substring
- * @exception E_SUCCESS The method is successful.
- * @exception E_OBJ_NOT_FOUND The specified string is not found.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result IndexOf(const String& str, int startIndex, int& indexOf) const;
-#ifdef TEST
- /**
- * Inserts the string representing the specified Unicode character
- * at the specified position in the calling instance.
- *
- * @since 2.0
- *
- * @return An error code
- *
- * @param[in] ch A Unicode character to insert
- * @param[in] indexAt The position of the character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result Insert(wchar_t ch, int indexAt);
-
- /**
- * Inserts the string representing the specified @c char value
- * at the specified position in the calling instance.
- *
- * @since 2.0
- *
- * @return An error code
- *
- * @param[in] ch A @c char value to insert
- * @param[in] indexAt The position of the character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result Insert(char ch, int indexAt);
-
- /**
- * Inserts the string representing the specified 16-bit integer
- * at the specified position in the calling instance.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] s A 16-bit integer value to insert
- * @param[in] indexAt The position of the character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result Insert(short s, int indexAt);
-
- /**
- * Inserts the string representing the specified 32-bit integer
- * at the specified position in the calling instance.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] i A 32-bit integer value to insert
- * @param[in] indexAt The position of the character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result Insert(int i, int indexAt);
-
- /**
- * Inserts the string representing the specified @c long value
- * at the specified position in the calling instance.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] l A @c long value to insert
- * @param[in] indexAt The position of the character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result Insert(long l, int indexAt);
-
- /**
- * Inserts the string representing the specified @c long @c long value
- * at the specified position in the calling instance.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] ll A @c long @c long value to insert
- * @param[in] indexAt The position of the character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result Insert(long long ll, int indexAt);
-
- /**
- * Inserts the string representing the specified @c float value
- * at the specified position in the calling instance.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] f A @c float value to insert
- * @param[in] indexAt The position of the character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result Insert(float f, int indexAt);
-
- /**
- * Inserts the string representing the specified @c double value
- * at the specified position in the calling instance.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] d A @c double value to insert
- * @param[in] indexAt The position of the character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result Insert(double d, int indexAt);
-
- /**
- * Inserts the string representing the specified @c null-terminated
- * string at the specified position in the calling instance.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] p An instance of %String to insert
- * @param[in] indexAt The position of the character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
- * @exception E_INVALID_ARG A @c null pointer is passed.
- */
- result Insert(const wchar_t* p, int indexAt);
-
- /**
- * Inserts the string representing the specified instance of %String
- * at the specified position in the calling instance.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] str An instance of %String to insert
- * @param[in] indexAt The position of the character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result Insert(const String& str, int indexAt);
-#endif
- /**
- * Searches the calling instance for the last occurrence of the specified character and returns its index. @n
- * The search begins at the @c startIndex position and proceeds backward towards the beginning.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] ch The Unicode character to locate
- * @param[in] startIndex The starting position of search
- * @param[out] indexOf The index of character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OBJ_NOT_FOUND The specified character is not found.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result LastIndexOf(wchar_t ch, int startIndex, int& indexOf) const;
-
- /**
- * Searches the calling instance for the last occurrence of the specified substring and returns its index. @n
- * The search begins at the @c startIndex position and proceeds backward towards the beginning.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] str An instance of %String to locate
- * @param[in] startIndex The starting position of search
- * @param[out] indexOf The index of the substring
- * @exception E_SUCCESS The method is successful.
- * @exception E_OBJ_NOT_FOUND The specified character is not found.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0.
- * @remarks If the substring is empty, E_SUCCESS is returned and the value of @c indexOf is set to @c startIndex.
- */
- result LastIndexOf(const String& str, int startIndex, int& indexOf) const;
-
- /**
- * Removes the characters within the specified range.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] startIndex The position where the removal begins
- * @param[in] length The number of characters to remove
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE Either of the following conditions has occurred: @n
- * - The specified index is out of range. @n
- * - The specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0. @n
- * - The specified @c count is either greater than the length of substring starting from @c startIndex or less than @c 0.
- */
- result Remove(int startIndex, int length);
-
- /**
- * Replaces all occurrences of the specified characters.
- *
- * @since 2.0
- *
- * @param[in] original The character to replace
- * @param[in] replace The character to replace all occurrences of @c original
- */
- void Replace(wchar_t original, wchar_t replace);
-
- /**
- * Replaces all occurrences of the specified string.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] original An instance of %String to replace
- * @param[in] replace An instance of %String to replace all occurrences of @c original
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified @c original is an empty string.
- */
- result Replace(const String& original, const String& replace);
-
- /**
- * Replaces all occurrences of the specified string within the substring
- * of this instance of %String.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] original An instance of %String to replace
- * @param[in] replace An instance of %String to replace all occurrences of @c original
- * @param[in] startIndex The starting position of the substring
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified @c original is an empty string.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result Replace(const String& original, const String& replace, int startIndex);
-
- /**
- * Reverses the sequence of characters in the calling instance.
- *
- * @since 2.0
- *
- */
- void Reverse(void);
-
- /**
- * Sets the capacity of this instance of %String.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] newCapacity The new capacity
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified @c capacity is negative.
- * @remarks If the new capacity is smaller than the current length, then
- * the text contained in this instance is truncated.
- */
- result SetCapacity(int newCapacity);
-
- /**
- * Sets the character at the specified index with the given character.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] ch A new character
+ /**
+ * Searches for a character in the calling instance. @n
+ * Gets the index of the first character that matches to
+ * the specified character in this instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] ch The Unicode character to locate
+ * @param[in] startIndex The starting position of search
+ * @param[out] indexOf The index of the character
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The specified character is not found.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result IndexOf(wchar_t ch, int startIndex, int& indexOf) const;
+
+ /**
+ * Searches for a specified substring in the calling instance. @n
+ * Gets the starting index of the first occurrence of the specified substring.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] str An instance of %String to locate
+ * @param[in] startIndex The starting position of the search
+ * @param[out] indexOf The index of the substring
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The specified string is not found.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result IndexOf(const String& str, int startIndex, int& indexOf) const;
+
+ /**
+ * Inserts the string representing the specified Unicode character
+ * at the specified position in the calling instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ *
+ * @param[in] ch A Unicode character to insert
+ * @param[in] indexAt The position of the character
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result Insert(wchar_t ch, int indexAt);
+
+ /**
+ * Inserts the string representing the specified @c char value
+ * at the specified position in the calling instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ *
+ * @param[in] ch A @c char value to insert
+ * @param[in] indexAt The position of the character
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result Insert(char ch, int indexAt);
+
+ /**
+ * Inserts the string representing the specified 16-bit integer
+ * at the specified position in the calling instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] s A 16-bit integer value to insert
+ * @param[in] indexAt The position of the character
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result Insert(short s, int indexAt);
+
+ /**
+ * Inserts the string representing the specified 32-bit integer
+ * at the specified position in the calling instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] i A 32-bit integer value to insert
+ * @param[in] indexAt The position of the character
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result Insert(int i, int indexAt);
+
+ /**
+ * Inserts the string representing the specified @c long value
+ * at the specified position in the calling instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] l A @c long value to insert
+ * @param[in] indexAt The position of the character
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result Insert(long l, int indexAt);
+
+ /**
+ * Inserts the string representing the specified @c long @c long value
+ * at the specified position in the calling instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] ll A @c long @c long value to insert
* @param[in] indexAt The position of the character
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result SetCharAt(wchar_t ch, int indexAt);
-
- /**
- * Sets the length of this instance of %String.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] newLength The new length
- * @exception E_SUCCESS The method is successful.
- * @exception E_INVALID_ARG The specified @c newLength is negative.
- * @remarks If the new length is greater than the current length, the
- * string is padded with spaces. On the other hand,
- * if the new length is smaller than the current length, then
- * the text contained in this instance is truncated.
- */
- result SetLength(int newLength);
-
- /**
- * Gets a substring starting from the given index.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] startIndex The starting index of the substring
- * @param[out] out The substring
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE The specified index is out of range, or
- * the specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0.
- */
- result SubString(int startIndex, String& out) const;
-
- /**
- * Gets a substring of the given length starting from the specified index.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[in] startIndex The starting position of the substring
- * @param[in] length The length of the substring
- * @param[out] out The substring
- * @exception E_SUCCESS The method is successful.
- * @exception E_OUT_OF_RANGE Either of the following conditions has occurred: @n
- * - The specified index is out of range. @n
- * - The specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0. @n
- * - The specified @c length is either greater than the length of substring starting from @c startIndex or less than @c 0.
- */
- result SubString(int startIndex, int length, String& out) const;
-
- /**
- * Checks whether this instance contains the specified text from the given index.
- *
- * @since 2.0
- *
- * @return @c true if this instance starts with the specified text, @n
- * else @c false
- * @param[in] str The string to match
- * @param[in] startIndex The start position of the string
- */
- bool StartsWith(const String& str, int startIndex) const;
-
- /**
- * Checks whether the given string is present at the end of the calling instance.
- *
- * @since 2.0
- *
- * @return @c true if this instance ends with the specified text, @n
- * else @c false
- * @param[in] str An instance of %String to match
- */
- bool EndsWith(const String& str) const;
-
- /**
- * @if OSPDEPREC
- * Gets the lowercase form of the string in the calling instance. @n
- * Unicode characters other than the English alphabets are not changed.
- *
- * @brief <i> [Deprecated] </i>
- * @deprecated This method is deprecated as a new method has been introduced.
- * Instead of using this method, use the ToLowerCase(%String& out) method that supports Unicode characters other than the English alphabets.
- * @since 2.0
- *
- * @return An error code
- * @param[out] out An instance of %String that contains the modified value of the calling instance
- * @exception E_SUCCESS The method is successful.
- * @endif
- */
- result ToLower(String& out) const;
-
- /**
- * Gets the lowercase form of the string in the calling instance. @n
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result Insert(long long ll, int indexAt);
+
+ /**
+ * Inserts the string representing the specified @c float value
+ * at the specified position in the calling instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] f A @c float value to insert
+ * @param[in] indexAt The position of the character
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result Insert(float f, int indexAt);
+
+ /**
+ * Inserts the string representing the specified @c double value
+ * at the specified position in the calling instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] d A @c double value to insert
+ * @param[in] indexAt The position of the character
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result Insert(double d, int indexAt);
+
+ /**
+ * Inserts the string representing the specified @c null-terminated
+ * string at the specified position in the calling instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] p An instance of %String to insert
+ * @param[in] indexAt The position of the character
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
+ * @exception E_INVALID_ARG A @c null pointer is passed.
+ */
+ result Insert(const wchar_t* p, int indexAt);
+
+ /**
+ * Inserts the string representing the specified instance of %String
+ * at the specified position in the calling instance.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] str An instance of %String to insert
+ * @param[in] indexAt The position of the character
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result Insert(const String& str, int indexAt);
+
+ /**
+ * Searches the calling instance for the last occurrence of the specified character and returns its index. @n
+ * The search begins at the @c startIndex position and proceeds backward towards the beginning.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] ch The Unicode character to locate
+ * @param[in] startIndex The starting position of search
+ * @param[out] indexOf The index of character
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The specified character is not found.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result LastIndexOf(wchar_t ch, int startIndex, int& indexOf) const;
+
+ /**
+ * Searches the calling instance for the last occurrence of the specified substring and returns its index. @n
+ * The search begins at the @c startIndex position and proceeds backward towards the beginning.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] str An instance of %String to locate
+ * @param[in] startIndex The starting position of search
+ * @param[out] indexOf The index of the substring
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OBJ_NOT_FOUND The specified character is not found.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0.
+ * @remarks If the substring is empty, E_SUCCESS is returned and the value of @c indexOf is set to @c startIndex.
+ */
+ result LastIndexOf(const String& str, int startIndex, int& indexOf) const;
+
+ /**
+ * Removes the characters within the specified range.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] startIndex The position where the removal begins
+ * @param[in] length The number of characters to remove
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE Either of the following conditions has occurred: @n
+ * - The specified index is out of range. @n
+ * - The specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0. @n
+ * - The specified @c count is either greater than the length of substring starting from @c startIndex or less than @c 0.
+ */
+ result Remove(int startIndex, int length);
+
+ /**
+ * Replaces all occurrences of the specified characters.
+ *
+ * @since 2.0
+ *
+ * @param[in] original The character to replace
+ * @param[in] replace The character to replace all occurrences of @c original
+ */
+ void Replace(wchar_t original, wchar_t replace);
+
+ /**
+ * Replaces all occurrences of the specified string.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] original An instance of %String to replace
+ * @param[in] replace An instance of %String to replace all occurrences of @c original
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c original is an empty string.
+ */
+ result Replace(const String& original, const String& replace);
+
+ /**
+ * Replaces all occurrences of the specified string within the substring
+ * of this instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] original An instance of %String to replace
+ * @param[in] replace An instance of %String to replace all occurrences of @c original
+ * @param[in] startIndex The starting position of the substring
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c original is an empty string.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result Replace(const String& original, const String& replace, int startIndex);
+
+ /**
+ * Reverses the sequence of characters in the calling instance.
+ *
+ * @since 2.0
+ *
+ */
+ void Reverse(void);
+
+ /**
+ * Sets the capacity of this instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] newCapacity The new capacity
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c capacity is negative.
+ * @remarks If the new capacity is smaller than the current length, then
+ * the text contained in this instance is truncated.
+ */
+ result SetCapacity(int newCapacity);
+
+ /**
+ * Sets the character at the specified index with the given character.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] ch A new character
+ * @param[in] indexAt The position of the character
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c indexAt is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result SetCharAt(wchar_t ch, int indexAt);
+
+ /**
+ * Sets the length of this instance of %String.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] newLength The new length
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_INVALID_ARG The specified @c newLength is negative.
+ * @remarks If the new length is greater than the current length, the
+ * string is padded with spaces. On the other hand,
+ * if the new length is smaller than the current length, then
+ * the text contained in this instance is truncated.
+ */
+ result SetLength(int newLength);
+
+ /**
+ * Gets a substring starting from the given index.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] startIndex The starting index of the substring
+ * @param[out] out The substring
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE The specified index is out of range, or
+ * the specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0.
+ */
+ result SubString(int startIndex, String& out) const;
+
+ /**
+ * Gets a substring of the given length starting from the specified index.
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[in] startIndex The starting position of the substring
+ * @param[in] length The length of the substring
+ * @param[out] out The substring
+ * @exception E_SUCCESS The method is successful.
+ * @exception E_OUT_OF_RANGE Either of the following conditions has occurred: @n
+ * - The specified index is out of range. @n
+ * - The specified @c startIndex is either greater than or equal to the length of the current instance or less than @c 0. @n
+ * - The specified @c length is either greater than the length of substring starting from @c startIndex or less than @c 0.
+ */
+ result SubString(int startIndex, int length, String& out) const;
+
+ /**
+ * Checks whether this instance contains the specified text from the given index.
+ *
+ * @since 2.0
+ *
+ * @return @c true if this instance starts with the specified text, @n
+ * else @c false
+ * @param[in] str The string to match
+ * @param[in] startIndex The start position of the string
+ */
+ bool StartsWith(const String& str, int startIndex) const;
+
+ /**
+ * Checks whether the given string is present at the end of the calling instance.
+ *
+ * @since 2.0
+ *
+ * @return @c true if this instance ends with the specified text, @n
+ * else @c false
+ * @param[in] str An instance of %String to match
+ */
+ bool EndsWith(const String& str) const;
+
+ /**
+ * @if OSPDEPREC
+ * Gets the lowercase form of the string in the calling instance. @n
+ * Unicode characters other than the English alphabets are not changed.
+ *
+ * @brief <i> [Deprecated] </i>
+ * @deprecated This method is deprecated as a new method has been introduced.
+ * Instead of using this method, use the ToLowerCase(%String& out) method that supports Unicode characters other than the English alphabets.
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[out] out An instance of %String that contains the modified value of the calling instance
+ * @exception E_SUCCESS The method is successful.
+ * @endif
+ */
+ result ToLower(String& out) const;
+
+ /**
+ * Gets the lowercase form of the string in the calling instance. @n
* Unicode characters other than the English alphabets are also supported.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[out] out An instance of %String that contains the modified value of the calling instance
- * @exception E_SUCCESS The method is successful.
- */
- result ToLowerCase(String& out) const;
-
- /**
- * @if OSPDEPREC
- * Gets the uppercase form of the string in the calling instance. @n
- * Unicode characters other than the English alphabets are not changed.
- *
- * @brief <i> [Deprecated] </i>
- * @deprecated This method is deprecated as a new method has been introduced.
- * Instead of using this method, use the ToUpperCase(%String& out) method that supports Unicode characters other than the English alphabets.
- * @since 2.0
- *
- * @return An error code
- * @param[out] out An instance of %String that contains the modified value of the calling instance
- * @exception E_SUCCESS The method is successful.
- * @endif
- */
- result ToUpper(String& out) const;
-
- /**
- * Gets the uppercase form of the string in the calling instance. @n
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[out] out An instance of %String that contains the modified value of the calling instance
+ * @exception E_SUCCESS The method is successful.
+ */
+ result ToLowerCase(String& out) const;
+
+ /**
+ * @if OSPDEPREC
+ * Gets the uppercase form of the string in the calling instance. @n
+ * Unicode characters other than the English alphabets are not changed.
+ *
+ * @brief <i> [Deprecated] </i>
+ * @deprecated This method is deprecated as a new method has been introduced.
+ * Instead of using this method, use the ToUpperCase(%String& out) method that supports Unicode characters other than the English alphabets.
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[out] out An instance of %String that contains the modified value of the calling instance
+ * @exception E_SUCCESS The method is successful.
+ * @endif
+ */
+ result ToUpper(String& out) const;
+
+ /**
+ * Gets the uppercase form of the string in the calling instance. @n
* Unicode characters other than the English alphabets are also supported.
- *
- * @since 2.0
- *
- * @return An error code
- * @param[out] out An instance of %String that contains the modified value of the calling instance
- * @exception E_SUCCESS The method is successful.
- */
- result ToUpperCase(String& out) const;
-
- /**
- * @if OSPDEPREC
- * Converts all the letters in this instance to lowercase. @n
- * Unicode characters other than the English alphabets are not changed.
- *
- * @brief <i> [Deprecated] </i>
- * @deprecated This method is deprecated as a new method has been introduced.
- * Instead of using this method, use the ToLowerCase() method that supports Unicode characters other than the English alphabets.
- *
- * @since 2.0
- * @endif
- */
- void ToLower(void);
-
- /**
- * Converts all the letters in this instance to lowercase. @n
- * Unicode characters other than the English alphabets are also supported.
- *
- * @since 2.0
- */
- void ToLowerCase(void);
-
- /**
- * @if OSPDEPREC
- * Converts all the letters in this instance to uppercase. @n
- * Unicode characters other than the English alphabets are not changed.
- *
- * @brief <i> [Deprecated] </i>
- * @deprecated This method is deprecated as a new method has been introduced.
- * Instead of using this method, use the ToUpperCase() method that supports Unicode characters other than the English alphabets.
- *
- * @since 2.0
- * @endif
- */
- void ToUpper(void);
-
- /**
- * Converts all the letters in this instance to uppercase. @n
+ *
+ * @since 2.0
+ *
+ * @return An error code
+ * @param[out] out An instance of %String that contains the modified value of the calling instance
+ * @exception E_SUCCESS The method is successful.
+ */
+ result ToUpperCase(String& out) const;
+
+ /**
+ * @if OSPDEPREC
+ * Converts all the letters in this instance to lowercase. @n
+ * Unicode characters other than the English alphabets are not changed.
+ *
+ * @brief <i> [Deprecated] </i>
+ * @deprecated This method is deprecated as a new method has been introduced.
+ * Instead of using this method, use the ToLowerCase() method that supports Unicode characters other than the English alphabets.
+ *
+ * @since 2.0
+ * @endif
+ */
+ void ToLower(void);
+
+ /**
+ * Converts all the letters in this instance to lowercase. @n
+ * Unicode characters other than the English alphabets are also supported.
+ *
+ * @since 2.0
+ */
+ void ToLowerCase(void);
+
+ /**
+ * @if OSPDEPREC
+ * Converts all the letters in this instance to uppercase. @n
+ * Unicode characters other than the English alphabets are not changed.
+ *
+ * @brief <i> [Deprecated] </i>
+ * @deprecated This method is deprecated as a new method has been introduced.
+ * Instead of using this method, use the ToUpperCase() method that supports Unicode characters other than the English alphabets.
+ *
+ * @since 2.0
+ * @endif
+ */
+ void ToUpper(void);
+
+ /**
+ * Converts all the letters in this instance to uppercase. @n
* Unicode characters other than the English alphabets are also supported.
- *
- * @since 2.0
- */
- void ToUpperCase(void);
-
- /**
- * Trims the leading and trailing whitespace characters.
- *
- * @since 2.0
- */
- void Trim(void);
-
- /**
- * Gets the current capacity of this %String instance.
- *
- * @since 2.0
- *
- * @return The capacity of this %String instance
- */
- int GetCapacity(void) const;
-
- /**
- * Gets the length of the text contained in this %String instance.
- *
- * @since 2.0
- *
- * @return The length of this %String instance
- */
- int GetLength(void) const;
-
- /**
- * Gets a pointer to the instance's internal buffer.
- *
- * @since 2.0
- *
- * @return A Unicode pointer to the calling instance's internal buffer
- * @remarks GetPointer() does not guarantee that every call to this function returns same address.
- */
- const wchar_t* GetPointer(void) const;
-
- /**
- * Checks whether this instance contains the specified substring.
- *
- * @since 2.0
- *
- * @return @c true if this instance contains the specified substring, @n
- * else @c false
- * @param[in] str The string to match
- */
- bool Contains(const String& str) const;
-
- /**
- * A constant holding the default capacity of %String.
- *
- * @since 2.0
- */
- static const unsigned long DEFAULT_CAPACITY = 16;
+ *
+ * @since 2.0
+ */
+ void ToUpperCase(void);
+
+ /**
+ * Trims the leading and trailing whitespace characters.
+ *
+ * @since 2.0
+ */
+ void Trim(void);
+
+ /**
+ * Gets the current capacity of this %String instance.
+ *
+ * @since 2.0
+ *
+ * @return The capacity of this %String instance
+ */
+ int GetCapacity(void) const;
+
+ /**
+ * Gets the length of the text contained in this %String instance.
+ *
+ * @since 2.0
+ *
+ * @return The length of this %String instance
+ */
+ int GetLength(void) const;
+
+ /**
+ * Gets a pointer to the instance's internal buffer.
+ *
+ * @since 2.0
+ *
+ * @return A Unicode pointer to the calling instance's internal buffer
+ * @remarks GetPointer() does not guarantee that every call to this function returns same address.
+ */
+ const wchar_t* GetPointer(void) const;
+
+ /**
+ * Checks whether this instance contains the specified substring.
+ *
+ * @since 2.0
+ *
+ * @return @c true if this instance contains the specified substring, @n
+ * else @c false
+ * @param[in] str The string to match
+ */
+ bool Contains(const String& str) const;
+
+ /**
+ * A constant holding the default capacity of %String.
+ *
+ * @since 2.0
+ */
+ static const unsigned long DEFAULT_CAPACITY = 16;
private:
- //
- // Allocates an internal buffer with the specified capacity.
- // @return An error code
- // @param[in] capacity The initial capacity of this instance of %String
- //
- bool AllocateCapacity(int capacity);
-
- //
- // Expands the size of the internal buffer that is greater than or equal
- // to the specified capacity.
- // @return @c true if the capacity is expanded, @n
- // else @c false
- // @param[in] capacity The new capacity of this instance of %String
- //
- bool ExpandCapacity(int minCapacity);
-
- //
- // Initializes __pValue and __pRefCount
- //
- // @since 2.0
- //
- result InitializeToDefault(int capacity);
-
- //
- // When the reference count is bigger than 1 and it is not UNSHAREABLE, copies__pValue and subtracts and initializes __pRefCount.
- // If the isUnshareable is true, this method sets the reference count to UNSHAREABLE.
- //
- // @since 2.2
- //
- result AboutToModify(int capacity, bool isUnshareable = false);
-
- //
- // Swaps member-wisely
- //
- // @since 2.0
- //
- void Swap(String& str);
+ //
+ // Allocates an internal buffer with the specified capacity.
+ // @return An error code
+ // @param[in] capacity The initial capacity of this instance of %String
+ //
+ bool AllocateCapacity(int capacity);
+
+ //
+ // Expands the size of the internal buffer that is greater than or equal
+ // to the specified capacity.
+ // @return @c true if the capacity is expanded, @n
+ // else @c false
+ // @param[in] capacity The new capacity of this instance of %String
+ //
+ bool ExpandCapacity(int minCapacity);
+
+ //
+ // Initializes __pValue and __pRefCount
+ //
+ // @since 2.0
+ //
+ result InitializeToDefault(int capacity);
+
+ //
+ // Copies __pValue and subtract and initialize __pRefCount
+ //
+ // @since 2.0
+ //
+ result CopyOnWrite(int capacity);
+
+ //
+ // Swaps member-wisely
+ //
+ // @since 2.0
+ //
+ void Swap(String& str);
int __capacity;
int __length;
mutable int __hash;
- mutable volatile int* __pRefCount;
+ mutable int* __pRefCount;
mutable wchar_t* __pValue;
static const float GROWTH_FACTOR;
- static const int UNSHAREABLE;
class _StringImpl * __pStringImpl;
friend class _StringImpl;
#define _FBASE_SYS_LOG_H_
#include <stdarg.h>
+#include <FBaseResult.h>
#include <FOspConfig.h>
#include <FBaseDataType.h>
#include <FBaseColArrayListT.h>
#include <FBaseColMapEntryT.h>
#include <FBaseComparerT.h>
-#if TEST
+//#if TEST
#include <FBaseFloat.h>
-#endif
+//#endif
namespace Tizen { namespace Base { namespace Collection
{
__capacity <<= 1;
}
}
-#if TEST
- if (Float::Compare(loadFactor, 0) == 0)
-#endif
+//#if TEST
+ if (Tizen::Base::Float::Compare(loadFactor, 0) == 0)
+//#endif
{
__loadFactor = DEFAULT_LOAD_FACTOR;
}
-#if TEST
+//#if TEST
else
{
__loadFactor = loadFactor;
}
-#endif
+//#endif
__threshold = static_cast< int >(__capacity * __loadFactor);
TryReturn(loadFactor >= 0, E_INVALID_ARG, "[%s] The loadFactor(%f) MUST be greater than or equal to 0.0.", GetErrorMessage(E_INVALID_ARG), loadFactor);
result r = E_SUCCESS;
-#if TEST
+//#if TEST
if (Float::Compare(loadFactor, 0) == 0)
-#endif
+//#endif
{
loadFactor = DEFAULT_LOAD_FACTOR;
}
__capacity <<= 1;
}
}
-#if TEST
+//#if TEST
if (Float::Compare(loadFactor, 0) == 0)
-#endif
+//#endif
{
__loadFactor = DEFAULT_LOAD_FACTOR;
}
-#if TEST
+//#if TEST
else
{
__loadFactor = loadFactor;
}
-#endif
+//#endif
__threshold = static_cast< int >(__capacity * __loadFactor);
TryReturn((loadFactor >= 0), E_INVALID_ARG, "[%s] The loadFactor(%f) MUST be greater than or equal to 0.0.", GetErrorMessage(E_INVALID_ARG), loadFactor);
result r = E_SUCCESS;
-#if TEST
+//#if TEST
if (Float::Compare(loadFactor, 0) == 0)
-#endif
+//#endif
{
loadFactor = DEFAULT_LOAD_FACTOR;
}
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FUiAnim_AnimationManager.cpp
+ * @brief This file contains implementation of _AnimationManager class
+ *
+ * This file contains implementation _AnimationManager class.
+ */
+
+#include <wchar.h>
+
+#include <FBaseSysLog.h>
+#include <FBaseStringHashCodeProvider.h>
+#include "FUiAnim_DynamicProperty.h"
+
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+
+//#define PRINT(FMT__,...) print(FMT__, __VA_ARGS__)
+//#define PRINT(...) SysLog(NID_UI_ANIM, __VA_ARGS__)
+#define PRINT(...)
+
+//static void PRINT(const char* format ,...)
+//{
+// va_list arg;
+// va_start(arg,format);
+// vfprintf(stderr,format, arg);
+// va_end(arg);
+//}
+
+namespace Tizen { namespace Ui { namespace Animations
+{
+
+
+
+_DynamicKeyString::_DynamicKeyString(const Tizen::Base::String& keyString)
+{
+ __name = keyString;
+ const wchar_t* pDelimiter = L".";
+
+ wchar_t temp[__name.GetLength()+1];
+
+ wcscpy(temp, __name.GetPointer());
+
+ wchar_t* pSrc = temp;
+ wchar_t* pToken = null;
+#ifndef _WIN32
+ do
+ {
+ pToken = wcstok(pSrc, pDelimiter, &pSrc);
+
+
+ if(pToken)
+ {
+ if(pToken[0] == '#')
+ {
+ __subStrings.Add(String(&pToken[1]));
+ }
+ }
+ }while(pToken);
+#else
+ pToken = wcstok(pSrc, pDelimiter);
+ if(pToken)
+ {
+ if(pToken[0] == '#')
+ {
+ __subStrings.Add(String(&pToken[1]));
+ }
+ }
+
+ while(pToken)
+ {
+ pToken = wcstok(null, pDelimiter); ///SRK test
+ if(pToken)
+ {
+ if(pToken[0] == '#')
+ {
+ __subStrings.Add(String(&pToken[1]));
+ }
+ }
+ };
+#endif
+}
+
+_DynamicKeyString::_DynamicKeyString(const wchar_t* pKeyString)
+{
+ __name.Append(pKeyString);
+ const wchar_t* pDelimiter = L".";
+
+
+ wchar_t temp[__name.GetLength()+1];
+
+ wcscpy(temp, __name.GetPointer());
+
+ wchar_t* pSrc = temp;
+ wchar_t* pToken = null;
+
+#ifndef _WIN32
+ do
+ {
+ pToken = wcstok(pSrc, pDelimiter, &pSrc);
+ if(pToken)
+ {
+ if(pToken[0] == '#')
+ {
+ __subStrings.Add(String(&pToken[1]));
+ }
+ }
+ }while(pToken);
+
+#else
+ pToken = wcstok(pSrc, pDelimiter);
+ if(pToken)
+ {
+ if(pToken[0] == '#')
+ {
+ __subStrings.Add(String(&pToken[1]));
+ }
+ }
+ while(pToken)
+ {
+ pToken = wcstok(null, pDelimiter); ///SRK test
+ if(pToken)
+ {
+ if(pToken[0] == '#')
+ {
+ __subStrings.Add(&pToken[1]);
+ }
+ }
+ };
+#endif
+}
+
+
+bool
+_DynamicKeyString::Compare(const Tizen::Base::String& comparekey, int at) const
+{
+ const wchar_t* pSrc = __name.GetPointer();
+ const wchar_t* pDst = comparekey.GetPointer();
+ int srcLen = __name.GetLength();
+ int dstLen = comparekey.GetLength();
+
+ if(srcLen <= at)
+ {
+ return false;
+ }
+
+ for(int i = at, j = at ; i < srcLen && j < dstLen ; i++, j++)
+ {
+ if(pSrc[i] == '#')
+ {
+ if(pDst[j] != '#')
+ {
+ return false;
+ }
+
+ for( ;pSrc[i] != 0;i++)
+ {
+ if(pSrc[i] == '.')
+ break;
+ }
+
+ }
+ if(pDst[j] == '#')
+ {
+ for( ;pDst[j] != 0;j++)
+ {
+ if(pDst[j] == '.')
+ break;
+ }
+ }
+
+ if(pSrc[i] != pDst[j])
+ {
+ return false;
+ }
+
+ }
+ return true;
+}
+
+
+const Tizen::Base::String
+_DynamicKeyString::GetSubString(int index) const
+{
+ String resString;
+ if(__subStrings.GetAt(index, resString) != E_SUCCESS)
+ {
+ }
+ return resString;
+}
+
+
+static wchar_t __valueString[1024];
+
+_DyanamicPropertyString::_DyanamicPropertyString(_DynamicKeyString& keyString, const Tizen::Base::String& property, int at)
+ :__keyString(keyString)
+{
+ __isAvailable = __keyString.Compare(property,at);
+ static ComparerT<String> comparer;
+ static StringHashCodeProvider strHashCodeProvider;
+
+ if(__isAvailable == true)
+ {
+ __map.Construct(16, 0.75, strHashCodeProvider, comparer);
+
+ int count = __keyString.GetSubStringCount();
+ int subIndex = 0;
+
+ const wchar_t* pDst = property.GetPointer();
+
+ for(int j = at ; pDst[j]!=0 ; j++)
+ {
+ if(pDst[j] == '#')
+ {
+ if(subIndex >= count)
+ {
+ // error
+ __isAvailable = false;
+ return;
+ }
+ const String& keyName = __keyString.GetSubString(subIndex);
+ if(keyName.IsEmpty())
+ {
+ // error
+ __isAvailable = false;
+ return;
+ }
+
+ j++;
+ __valueString[0] = 0;
+ int i = 0;
+ for( ; pDst[j] != 0 ; j++, i++)
+ {
+ if(pDst[j] == '.')
+ break;
+ __valueString[i] = pDst[j];
+ }
+ __valueString[i+1] = 0;
+ __map.Add(keyName , String(__valueString));
+ subIndex++;
+ }
+ }
+
+ }
+}
+
+Tizen::Base::String
+_DyanamicPropertyString::GetValue(const Tizen::Base::String& key) const
+{
+ String value;
+ if(!__isAvailable)
+ {
+ return value;
+ }
+
+ bool out = false;
+
+ __map.ContainsKey(key,out);
+ if(out != true)
+ {
+ return value;
+ }
+
+ __map.GetValue(key, value);
+ return value;
+}
+
+
+result
+_DyanamicPropertyString::GetValueToInteger(const Tizen::Base::String& key, long& value) const
+{
+ if(!__isAvailable)
+ {
+ return E_INVALID_STATE;
+ }
+
+ bool out = false;
+
+ __map.ContainsKey(key,out);
+ if(out != true)
+ {
+ return E_KEY_NOT_FOUND;
+ }
+
+ String valueStr;
+
+ __map.GetValue(key, valueStr);
+ if(valueStr.IsEmpty())
+ {
+ return E_INVALID_ARG;
+ }
+ value = wcstol(valueStr.GetPointer(), NULL, 10);
+
+ return E_SUCCESS;
+}
+
+}}} // Tizen::Ui::Animations
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FUiAnim_DynamicProperty.h
+ * @brief This is the header file for the _DynamicKeyString class.
+ *
+ * This header file contains the declarations of the _DynamicKeyString class.
+ */
+
+#ifndef _FUI_ANIM_INTERNAL_DYNAMIC_PROPERTY_H_
+#define _FUI_ANIM_INTERNAL_DYNAMIC_PROPERTY_H_
+
+#include <FOspConfig.h>
+#include <FBaseErrorDefine.h>
+#include <FBaseColArrayListT.h>
+#include <FBaseColHashMapT.h>
+
+#include <map>
+
+namespace Tizen { namespace Ui { namespace Animations
+{
+
+//keyString rule : '.' = token , '#' = name or value
+
+class _DynamicKeyString : public Tizen::Base::Object
+{
+public:
+ explicit _DynamicKeyString(const Tizen::Base::String& keyString);
+ explicit _DynamicKeyString(const wchar_t* pKeyString);
+
+ int GetSubStringCount() const
+ {
+ return __subStrings.GetCount();
+ }
+
+ const Tizen::Base::String GetKeyString() const
+ {
+ return __name;
+ }
+ const Tizen::Base::String GetSubString(int index) const;
+
+ bool Compare(const Tizen::Base::String& comparekey, int at = 0) const;
+
+private:
+ _DynamicKeyString(const _DynamicKeyString& rhs);
+ const _DynamicKeyString& operator = (const _DynamicKeyString& rhs);
+private:
+ Tizen::Base::String __name;
+ Tizen::Base::Collection::ArrayListT<Tizen::Base::String> __subStrings;
+};
+
+
+class _DyanamicPropertyString: public Tizen::Base::Object
+{
+public:
+ explicit _DyanamicPropertyString(_DynamicKeyString& keyString, const Tizen::Base::String& property, int at = 0);
+
+ Tizen::Base::String GetValue(const Tizen::Base::String& key) const;
+ result GetValueToInteger(const Tizen::Base::String& key, long& value) const;
+
+ bool IsAvailable() const
+ {
+ return __isAvailable;
+ }
+private:
+ _DyanamicPropertyString(const _DyanamicPropertyString& rhs);
+ const _DyanamicPropertyString& operator = (const _DyanamicPropertyString& rhs);
+
+private:
+ _DynamicKeyString& __keyString;
+
+ Tizen::Base::Collection::HashMapT<Tizen::Base::String, Tizen::Base::String> __map;
+ bool __isAvailable;
+
+// std::map<Tizen::Base::String, Tizen::Base::String> __map;
+};
+
+
+}}} // Tizen::Ui::Animations
+
+#endif //_FUI_ANIM_INTERNAL_ANIMATION_MANAGER_H_
+
--- /dev/null
+//
+// Open Service Platform
+// Copyright (c) 2012 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Apache License, Version 2.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file FUiAnim_AtomicInteger.h
+ * @brief This is the header file for the _AtomicInteger class.
+ *
+ * This header file contains the declarations of the _AtomicInteger class.
+ */
+
+#ifndef _FUI_ANIM_INTERNAL_ATOMIC_INTEGER_H_
+#define _FUI_ANIM_INTERNAL_ATOMIC_INTEGER_H_
+
+#include <FBaseSysLog.h>
+
+#define SMP_SUPPORT 1
+
+namespace
+{
+/*
+void BarrierByCompiler(void)
+{
+ __asm__ __volatile__ ("" ::: "memory");
+}
+
+
+#if defined(__i386__)
+
+#if SMP_SUPPORT == 0
+void MemoryBarrier(void)
+{
+ BarrierByCompiler();
+}
+#else
+void MemoryBarrier(void)
+{
+ __asm__ __volatile__ ("mfence" ::: "memory");
+}
+#endif
+
+#elif defined(__arm__)
+
+#if SMP_SUPPORT == 0
+void MemoryBarrier(void)
+{
+ BarrierByCompiler();
+}
+#else
+void MemoryBarrier(void)
+{
+ __asm__ __volatile__ ("dmb" ::: "memory");
+}
+#endif
+
+#endif
+*/
+}
+
+namespace Tizen { namespace Ui { namespace Animations
+{
+
+class _AtomicInteger
+{
+public:
+ bool operator ==(int value) const
+ {
+ return counter == value;
+ }
+
+ bool operator !=(int value) const
+ {
+ return counter != value;
+ }
+
+ bool operator !() const
+ {
+ return counter == 0;
+ }
+
+ operator int() const
+ {
+ return counter;
+ }
+
+ inline _AtomicInteger& operator =(int value)
+ {
+ // CHECKME: Is this safe for i386/arm architecture ?
+ counter = value;
+
+ return *this;
+ }
+
+ inline int Add(int increment);
+ inline int CompareAndExchange(int exchange, int comparand);
+
+public:
+ volatile int counter;
+};
+
+
+
+//#if defined(__i386__)
+inline int
+_AtomicInteger::Add(int increment)
+{
+// counter += increment; //add srk
+// int ret = counter; //add srk
+ int ret;
+
+ __asm__ __volatile__(
+ "lock; xaddl %0, (%1)"
+ : "=r" (ret)
+ : "r" (&counter), "0" (increment)
+ : "memory"
+ );
+
+ return ret;
+}
+
+inline int
+_AtomicInteger::CompareAndExchange(int exchange, int comparand)
+{
+
+ int ret;
+
+ // CHECKME: Memory barrier is not needed...... ???
+
+ __asm__ __volatile__ (
+ "lock; cmpxchgl %2, %1\n\t"
+ : "=a" (ret), "+m" (counter)
+ : "r" (exchange), "0" (comparand)
+ : "memory"
+ );
+
+ return ret;
+}
+/*#elif defined(__arm__)
+inline int
+_AtomicInteger::Add(int increment)
+{
+ int prev;
+ int tmp;
+ int status;
+
+ MemoryBarrier();
+
+ do
+ {
+ __asm__ __volatile__ (
+ "ldrex %0, [%4]\n"
+ "add %1, %0, %5\n"
+ "strex %2, %1, [%4]"
+ : "=&r" (prev), "=&r" (tmp), "=&r" (status), "+m" (counter)
+ : "r" (&counter), "Ir" (increment)
+ : "cc"
+ );
+ }
+ while (unlikely(status != 0));
+
+ return prev;
+}
+
+inline int
+_AtomicInteger::CompareAndExchange(int exchange, int comparand)
+{
+ int prev;
+ int status;
+
+ MemoryBarrier();
+
+ do
+ {
+ __asm__ __volatile__ (
+ "ldrex %0, [%3]\n\t"
+ "mov %1, #0\n\t"
+ "teq %0, %4\n\t"
+ "strexeq %1, %5, [%3]\n\t"
+ : "=&r" (prev), "=&r" (status), "+m"(counter)
+ : "r" (&counter), "Ir" (comparand), "r" (exchange)
+ : "cc"
+ );
+ }
+ while (unlikely(status != 0));
+
+ MemoryBarrier();
+
+ return prev;
+}
+#elif _WIN32
+#else
+#error Unknown architectue for atomic operations !
+#endif
+*/
+}}} // Tizen::Ui::Animations
+
+#endif // _FUI_ANIM_INTERNAL_ATOMIC_INTEGER_H_
+