LCOV - code coverage report
Current view: top level - lib - unicode.h (source / functions) Hit Total Coverage
Test: coverage.info Lines: 4 4 100.0 %
Date: 2016-09-14 01:02:56 Functions: 2 2 100.0 %
Branches: 6 8 75.0 %

           Branch data     Line data    Source code
       1                 :            : /*
       2                 :            :  * Copyright (c) 2009, 2010 Nicira, Inc.
       3                 :            :  *
       4                 :            :  * Licensed under the Apache License, Version 2.0 (the "License");
       5                 :            :  * you may not use this file except in compliance with the License.
       6                 :            :  * You may obtain a copy of the License at:
       7                 :            :  *
       8                 :            :  *     http://www.apache.org/licenses/LICENSE-2.0
       9                 :            :  *
      10                 :            :  * Unless required by applicable law or agreed to in writing, software
      11                 :            :  * distributed under the License is distributed on an "AS IS" BASIS,
      12                 :            :  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
      13                 :            :  * See the License for the specific language governing permissions and
      14                 :            :  * limitations under the License.
      15                 :            :  */
      16                 :            : 
      17                 :            : #ifndef UNICODE_H
      18                 :            : #define UNICODE_H 1
      19                 :            : 
      20                 :            : #include <stdbool.h>
      21                 :            : #include <stddef.h>
      22                 :            : #include "compiler.h"
      23                 :            : 
      24                 :            : /* Returns true if 'c' is a Unicode code point, otherwise false. */
      25                 :            : static inline bool
      26                 :            : uc_is_code_point(int c)
      27                 :            : {
      28                 :            :     return c >= 0 && c <= 0x10ffff;
      29                 :            : }
      30                 :            : 
      31                 :            : /* Returns true if 'c' is a Unicode code point for a leading surrogate. */
      32                 :            : static inline bool
      33                 :         13 : uc_is_leading_surrogate(int c)
      34                 :            : {
      35 [ +  + ][ +  - ]:         13 :     return c >= 0xd800 && c <= 0xdbff;
      36                 :            : }
      37                 :            : 
      38                 :            : /* Returns true if 'c' is a Unicode code point for a trailing surrogate. */
      39                 :            : static inline bool
      40                 :          3 : uc_is_trailing_surrogate(int c)
      41                 :            : {
      42 [ +  + ][ +  - ]:          3 :     return c >= 0xdc00 && c <= 0xdfff;
      43                 :            : }
      44                 :            : 
      45                 :            : /* Returns true if 'c' is a Unicode code point for a leading or trailing
      46                 :            :  * surrogate. */
      47                 :            : static inline bool
      48                 :            : uc_is_surrogate(int c)
      49                 :            : {
      50                 :            :     return c >= 0xd800 && c <= 0xdfff;
      51                 :            : }
      52                 :            : 
      53                 :            : int utf16_decode_surrogate_pair(int leading, int trailing);
      54                 :            : 
      55                 :            : size_t utf8_length(const char *);
      56                 :            : char *utf8_validate(const char *, size_t *lengthp) OVS_WARN_UNUSED_RESULT;
      57                 :            : 
      58                 :            : #endif /* unicode.h */

Generated by: LCOV version 1.12