Segmentation interface methods added. 88/34788/4
authorVictor Cebollada <v.cebollada@samsung.com>
Mon, 2 Feb 2015 17:05:24 +0000 (17:05 +0000)
committerVictor Cebollada <v.cebollada@samsung.com>
Wed, 4 Feb 2015 11:30:47 +0000 (11:30 +0000)
Change-Id: I1ecb55a78b0e0977f0ca0b232404c5c6281cca3f
Signed-off-by: Victor Cebollada <v.cebollada@samsung.com>
text/dali/internal/text-abstraction/segmentation-impl.cpp
text/dali/internal/text-abstraction/segmentation-impl.h
text/dali/public-api/text-abstraction/segmentation.cpp
text/dali/public-api/text-abstraction/segmentation.h
text/dali/public-api/text-abstraction/text-abstraction-definitions.h

index 5db3e28b21086443f6aa7bf27d3b944b46f89095..550613460d9780a937d36d56644fdcf093a255e7 100644 (file)
@@ -30,9 +30,8 @@ namespace Internal
 namespace TextAbstraction
 {
 
-
 Segmentation::Segmentation()
-:mPlugin(NULL)
+: mPlugin( NULL )
 {
 
 }
@@ -67,6 +66,20 @@ Dali::TextAbstraction::Segmentation Segmentation::Get()
    return segmentationHandle;
 }
 
-} // namespace Segmentation
+void Segmentation::GetLineBreakPositions( const Dali::TextAbstraction::Character* const text,
+                                          Dali::TextAbstraction::Length numberOfCharacters,
+                                          Dali::TextAbstraction::LineBreakInfo* breakInfo )
+{
+}
+
+void Segmentation::GetWordBreakPositions( const Dali::TextAbstraction::Character* const text,
+                                          Dali::TextAbstraction::Length numberOfCharacters,
+                                          Dali::TextAbstraction::WordBreakInfo* breakInfo )
+{
+}
+
+} // namespace TextAbstraction
+
 } // namespace Internal
+
 } // namespace Dali
index c87d594eebd3c73f8387d488e0e7d28dc657c9c0..12d771d7d57de0e646bd3303a2652b1c83a04296 100644 (file)
@@ -56,6 +56,21 @@ public:
    */
   static Dali::TextAbstraction::Segmentation Get();
 
+  /**
+   * @copydoc Dali::Segmentation::GetLineBreakPositions()
+   */
+  void GetLineBreakPositions( const Dali::TextAbstraction::Character* const text,
+                              Dali::TextAbstraction::Length numberOfCharacters,
+                              Dali::TextAbstraction::LineBreakInfo* breakInfo );
+
+
+  /**
+   * @copydoc Dali::Segmentation::GetWordBreakPositions()
+   */
+  void GetWordBreakPositions( const Dali::TextAbstraction::Character* const text,
+                              Dali::TextAbstraction::Length numberOfCharacters,
+                              Dali::TextAbstraction::WordBreakInfo* breakInfo );
+
 private:
 
   // Undefined copy constructor.
index 636f7a49c8aac4c235af80d03a0e72fc78d5a2e3..a339819e85e64fc2e9ad3d4aef676e3896f2bfa2 100644 (file)
@@ -30,11 +30,13 @@ namespace TextAbstraction
 Segmentation::Segmentation()
 {
 }
+
 Segmentation::~Segmentation()
 {
 }
-Segmentation::Segmentation(Dali::Internal::TextAbstraction::Segmentation *impl)
-  : BaseHandle(impl)
+
+Segmentation::Segmentation( Dali::Internal::TextAbstraction::Segmentation* implementation )
+: BaseHandle( implementation )
 {
 }
 
@@ -43,6 +45,24 @@ Segmentation Segmentation::Get()
   return Dali::Internal::TextAbstraction::Segmentation::Get();
 }
 
+void Segmentation::GetLineBreakPositions( const Character* const text,
+                                          Length numberOfCharacters,
+                                          LineBreakInfo* breakInfo )
+{
+  GetImplementation( *this ).GetLineBreakPositions( text,
+                                                    numberOfCharacters,
+                                                    breakInfo );
+}
+
+void Segmentation::GetWordBreakPositions( const Character* const text,
+                                          Length numberOfCharacters,
+                                          WordBreakInfo* breakInfo )
+{
+  GetImplementation( *this ).GetWordBreakPositions( text,
+                                                    numberOfCharacters,
+                                                    breakInfo );
+}
+
 } // namespace TextAbstraction
 
 } // namespace Dali
index 16f88b6eaa535756dc65a8fbdb95ff137d976817..1dd25bb508b4fe7f5dcab84d35fbeca49056b6ae 100644 (file)
  * limitations under the License.
  *
  */
+
+// INTERNAL INCLUDES
+#include <dali/public-api/text-abstraction/text-abstraction.h>
+
+// EXTERNAL INCLUDES
 #include <dali/public-api/object/base-handle.h>
 
 namespace Dali
@@ -34,7 +39,6 @@ class Segmentation;
 namespace TextAbstraction
 {
 
-
 /**
  *   Segmentation API
  *
@@ -44,33 +48,79 @@ class DALI_IMPORT_API Segmentation : public BaseHandle
 
 public:
 
-    /**
-     * @brief Create an uninitialized TextAbstraction handle.
-     *
-     */
-    Segmentation();
-
-    /**
-     * @brief Destructor
-     *
-     * This is non-virtual since derived Handle types must not contain data or virtual methods.
-     */
-    ~Segmentation();
-
-    /**
-     * @brief This constructor is used by Segmentation::Get().
-     *
-     * @param[in] segmentation  A pointer to the internal segmentation object.
-     */
-    explicit DALI_INTERNAL Segmentation( Dali::Internal::TextAbstraction::Segmentation* segmentation);
-
-    /**
-     * @brief Retrieve a handle to the Segmentation instance.
-     *
-     * @return A handle to the Segmentation
-     */
-    static Segmentation Get();
-
+  /**
+   * @brief Create an uninitialized TextAbstraction handle.
+   *
+   */
+  Segmentation();
+
+  /**
+   * @brief Destructor
+   *
+   * This is non-virtual since derived Handle types must not contain data or virtual methods.
+   */
+  ~Segmentation();
+
+  /**
+   * @brief This constructor is used by Segmentation::Get().
+   *
+   * @param[in] implementation A pointer to the internal segmentation object.
+   */
+  explicit DALI_INTERNAL Segmentation( Dali::Internal::TextAbstraction::Segmentation* implementation );
+
+  /**
+   * @brief Retrieve a handle to the Segmentation instance.
+   *
+   * @return A handle to the Segmentation
+   */
+  static Segmentation Get();
+
+  /**
+   * @brief Retrieves the line break info.
+   *
+   * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
+   *
+   * Possible values for LineBreakInfo are:
+   *
+   *  - 0 is a LINE_MUST_BREAK.  Text must be broken into a new line.
+   *  - 1 is a LINE_ALLOW_BREAK. Is possible to break the text into a new line.
+   *  - 2 is a LINE_NO_BREAK.    Text can't be broken into a new line.
+   *
+     @verbatim
+     i.e. Hello big\nworld produces:
+          2222212220 22220
+     @endverbatim
+   *
+   * @param[in] text Pointer to the first character of the text coded in UTF32.
+   * @param[in] numberOfCharacters The number of characters.
+   * @param[out] breakInfo The line break info.
+   */
+  void GetLineBreakPositions( const Character* const text,
+                              Length numberOfCharacters,
+                              LineBreakInfo* breakInfo );
+
+  /**
+   * @brief Retrieves the word break info.
+   *
+   * @pre @p breakInfo must have enough space allocated for @p numberOfCharacters.
+   *
+   * Possible values for WordBreakInfo are:
+   *
+   * - 0 is a WORD_BREAK.    Text can be broken into a new word.
+   * - 1 is a WORD_NO_BREAK. Text can't be broken into a new word.
+   *
+     @verbatim
+     i.e. Hello big\nworld produces:
+          1111001100 11110
+     @endverbatim
+   *
+   * @param[in] text Pointer to the first character of the text coded in UTF32.
+   * @param[in] numberOfCharacters The number of characters.
+   * @param[out] breakInfo The word break info.
+   */
+  void GetWordBreakPositions( const Character* const text,
+                              Length numberOfCharacters,
+                              WordBreakInfo* breakInfo );
 };
 
 } // namespace TextAbstraction
index 497f18b63b376d9fb5c8405116ac918fe85c9087..b4e48abb7f4d13da7eee9acdabca468b01d607c4 100644 (file)
@@ -35,6 +35,27 @@ typedef uint32_t Character;       ///< A UTF-32 representation of a character
 typedef uint32_t CharacterIndex;  ///< An index into an array of characters
 typedef uint32_t Length;          ///< The length of an array
 typedef uint32_t BidiInfoIndex;   ///< Index to the bidirectional info for a paragraph.
+typedef char     LineBreakInfo;   ///< Line break info (must break, allow break, no break).
+typedef char     WordBreakInfo;   ///< Word break info (break, no break).
+
+/**
+ * @brief Enumerates the possible line break info values.
+ */
+enum
+{
+  LINE_MUST_BREAK  = 0u, ///< Text must be broken into a new line.
+  LINE_ALLOW_BREAK = 1u, ///< Is possible to break the text into a new line.
+  LINE_NO_BREAK    = 2u  ///< Text can't be broken into a new line.
+};
+
+/**
+ * @brief Enumerates the possible word break info values.
+ */
+enum
+{
+  WORD_BREAK    = 0u, ///< Text can be broken into a new word.
+  WORD_NO_BREAK = 1u, ///< Text can't be broken into a new word.
+};
 
 } // namespace TextAbstraction