gecko/intl/lwbrk/public/nsILineBreaker.h
Ehsan Akhgari 0fd9123eac Bug 579517 - Part 1: Automated conversion of NSPR numeric types to stdint types in Gecko; r=bsmedberg
This patch was generated by a script.  Here's the source of the script for
future reference:

function convert() {
echo "Converting $1 to $2..."
find . ! -wholename "*nsprpub*" \
       ! -wholename "*security/nss*" \
       ! -wholename "*/.hg*" \
       ! -wholename "obj-ff-dbg*" \
       ! -name nsXPCOMCID.h \
       ! -name prtypes.h \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert PRInt8 int8_t
convert PRUint8 uint8_t
convert PRInt16 int16_t
convert PRUint16 uint16_t
convert PRInt32 int32_t
convert PRUint32 uint32_t
convert PRInt64 int64_t
convert PRUint64 uint64_t

convert PRIntn int
convert PRUintn unsigned

convert PRSize size_t

convert PROffset32 int32_t
convert PROffset64 int64_t

convert PRPtrdiff ptrdiff_t

convert PRFloat64 double
2012-08-22 11:56:38 -04:00

72 lines
2.6 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef nsILineBreaker_h__
#define nsILineBreaker_h__
#include "nsISupports.h"
#include "nscore.h"
#define NS_LINEBREAKER_NEED_MORE_TEXT -1
// {0x4b0b9e04-6ffb-4647-aa5f-2fa2ebd883e8}
#define NS_ILINEBREAKER_IID \
{0x4b0b9e04, 0x6ffb, 0x4647, \
{0xaa, 0x5f, 0x2f, 0xa2, 0xeb, 0xd8, 0x83, 0xe8}}
class nsILineBreaker : public nsISupports
{
public:
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ILINEBREAKER_IID)
enum {
kWordBreak_Normal = 0, // default
kWordBreak_BreakAll = 1, // break all
kWordBreak_KeepAll = 2 // always keep
};
virtual int32_t Next( const PRUnichar* aText, uint32_t aLen,
uint32_t aPos) = 0;
virtual int32_t Prev( const PRUnichar* aText, uint32_t aLen,
uint32_t aPos) = 0;
// Call this on a word with whitespace at either end. We will apply JISx4501
// rules to find breaks inside the word. aBreakBefore is set to the break-
// before status of each character; aBreakBefore[0] will always be false
// because we never return a break before the first character.
// aLength is the length of the aText array and also the length of the aBreakBefore
// output array.
virtual void GetJISx4051Breaks(const PRUnichar* aText, uint32_t aLength,
uint8_t aWordBreak,
uint8_t* aBreakBefore) = 0;
virtual void GetJISx4051Breaks(const uint8_t* aText, uint32_t aLength,
uint8_t aWordBreak,
uint8_t* aBreakBefore) = 0;
};
NS_DEFINE_STATIC_IID_ACCESSOR(nsILineBreaker, NS_ILINEBREAKER_IID)
static inline bool
NS_IsSpace(PRUnichar u)
{
return u == 0x0020 || // SPACE
u == 0x0009 || // CHARACTER TABULATION
u == 0x000D || // CARRIAGE RETURN
(0x2000 <= u && u <= 0x2006) || // EN QUAD, EM QUAD, EN SPACE,
// EM SPACE, THREE-PER-EM SPACE,
// FOUR-PER-SPACE, SIX-PER-EM SPACE,
(0x2008 <= u && u <= 0x200B); // PUNCTUATION SPACE, THIN SPACE,
// HAIR SPACE, ZERO WIDTH SPACE
}
static inline bool
NS_NeedsPlatformNativeHandling(PRUnichar aChar)
{
return (0x0e01 <= aChar && aChar <= 0x0fff); // Thai, Lao, Tibetan
}
#endif /* nsILineBreaker_h__ */