From 57f9f84392638560d1d93c2ed30dec244dc734c2 Mon Sep 17 00:00:00 2001 From: "ftang%netscape.com" Date: Tue, 9 Feb 1999 16:01:48 +0000 Subject: [PATCH] check in interface and not working stub --- intl/lwbrk/Makefile.in | 28 ++ intl/lwbrk/makefile.win | 21 ++ intl/lwbrk/public/nsIBinarySearchIterator.h | 42 +++ intl/lwbrk/public/nsILineBreaker.h | 52 ++++ intl/lwbrk/public/nsILineBreakerFactory.h | 39 +++ intl/lwbrk/public/nsILinearIterator.h | 42 +++ intl/lwbrk/public/nsIWordBreaker.h | 47 ++++ intl/lwbrk/public/nsIWordBreakerFactory.h | 39 +++ intl/lwbrk/public/nsLWBrkCIID.h | 27 ++ intl/lwbrk/src/Makefile.in | 43 +++ intl/lwbrk/src/jisx4051pairtable.txt | 286 ++++++++++++++++++++ intl/lwbrk/src/makefile.win | 70 +++++ intl/lwbrk/src/nsJISx4501LineBreaker.cpp | 70 +++++ intl/lwbrk/src/nsJISx4501LineBreaker.h | 49 ++++ intl/lwbrk/src/nsLWBreakerFImp.cpp | 78 ++++++ intl/lwbrk/src/nsLWBreakerFImp.h | 46 ++++ intl/lwbrk/src/nsLWBrk.cpp | 115 ++++++++ intl/lwbrk/src/nsLWIMP.h | 27 ++ intl/lwbrk/src/nsSampleWordBreaker.cpp | 53 ++++ intl/lwbrk/src/nsSampleWordBreaker.h | 44 +++ 20 files changed, 1218 insertions(+) create mode 100644 intl/lwbrk/Makefile.in create mode 100644 intl/lwbrk/makefile.win create mode 100644 intl/lwbrk/public/nsIBinarySearchIterator.h create mode 100644 intl/lwbrk/public/nsILineBreaker.h create mode 100644 intl/lwbrk/public/nsILineBreakerFactory.h create mode 100644 intl/lwbrk/public/nsILinearIterator.h create mode 100644 intl/lwbrk/public/nsIWordBreaker.h create mode 100644 intl/lwbrk/public/nsIWordBreakerFactory.h create mode 100644 intl/lwbrk/public/nsLWBrkCIID.h create mode 100644 intl/lwbrk/src/Makefile.in create mode 100644 intl/lwbrk/src/jisx4051pairtable.txt create mode 100644 intl/lwbrk/src/makefile.win create mode 100644 intl/lwbrk/src/nsJISx4501LineBreaker.cpp create mode 100644 intl/lwbrk/src/nsJISx4501LineBreaker.h create mode 100644 intl/lwbrk/src/nsLWBreakerFImp.cpp create mode 100644 intl/lwbrk/src/nsLWBreakerFImp.h create mode 100644 intl/lwbrk/src/nsLWBrk.cpp create mode 100644 intl/lwbrk/src/nsLWIMP.h create mode 100644 intl/lwbrk/src/nsSampleWordBreaker.cpp create mode 100644 intl/lwbrk/src/nsSampleWordBreaker.h diff --git a/intl/lwbrk/Makefile.in b/intl/lwbrk/Makefile.in new file mode 100644 index 00000000000..df7920d17a2 --- /dev/null +++ b/intl/lwbrk/Makefile.in @@ -0,0 +1,28 @@ +#!gmake +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +DEPTH = ../.. +topsrcdir = @top_srcdir@ +VPATH = @srcdir@ +srcdir = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +DIRS = public src + +# DIRS += tests tools + +include $(topsrcdir)/config/rules.mk diff --git a/intl/lwbrk/makefile.win b/intl/lwbrk/makefile.win new file mode 100644 index 00000000000..4142281fd98 --- /dev/null +++ b/intl/lwbrk/makefile.win @@ -0,0 +1,21 @@ +#!nmake +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. +DEPTH=..\.. +IGNORE_MANIFEST=1 + +DIRS= public src +include <$(DEPTH)\config\rules.mak> diff --git a/intl/lwbrk/public/nsIBinarySearchIterator.h b/intl/lwbrk/public/nsIBinarySearchIterator.h new file mode 100644 index 00000000000..50a5b62b2d9 --- /dev/null +++ b/intl/lwbrk/public/nsIBinarySearchIterator.h @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsIBinarySearchIterator_h__ +#define nsIBinarySearchIterator_h__ + + +#include "nsISupports.h" +#include "nscore.h" + +// {E86B3373-BF89-11d2-B3AF-00805F8A6670} +#define NS_IBINARYSEARCHITERATOR_IID \ +{ 0xe86b3373, 0xbf89, 0x11d2, \ + { 0xb3, 0xaf, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }; + + +class nsIBinarySearchIterator : public nsISupports { + +public: + + NS_IMETHOD First() = 0; + NS_IMETHOD Next(PRBool aForward) = 0; + NS_IMETHOD Current(PRUint32 *oPosition) = 0; + NS_IMETHOD IsDone(PRBool *oResult) = 0; + +}; + +#endif /* nsIBinarySearchIterator_h__ */ diff --git a/intl/lwbrk/public/nsILineBreaker.h b/intl/lwbrk/public/nsILineBreaker.h new file mode 100644 index 00000000000..904610b95b8 --- /dev/null +++ b/intl/lwbrk/public/nsILineBreaker.h @@ -0,0 +1,52 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsILineBreaker_h__ +#define nsILineBreaker_h__ + + +#include "nsISupports.h" +#include "nsILinearIterator.h" +#include "nsIBinarySearchIterator.h" +#include "nsString.h" + +#include "nscore.h" + +// {E86B3375-BF89-11d2-B3AF-00805F8A6670} +#define NS_ILINEBREAKER_IID \ +{ 0xe86b3375, 0xbf89, 0x11d2, \ + { 0xb3, 0xaf, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }; + + +class nsILineBreaker : public nsISupports +{ + NS_IMETHOD BreakInBetween(PRUnichar* aText1 , PRUint32 aTextLen1, + PRUnichar* aText2 , PRUint32 aTextLen2, + PRBool *oCanBreak) = 0; + NS_IMETHOD GetLinearIterator(PRUnichar* aText, PRUint32 aLen, + nsILinearIterator** iterator, + PRBool aForward = PR_TRUE, + PRBool aCanBreak = PR_TRUE) = 0; + NS_IMETHOD GetBinarySearchIterator(PRUnichar* aText, PRUint32 aLen, + nsIBinarySearchIterator** iterator) = 0; + NS_IMETHOD GetConnector(PRUnichar* aText, PRUint32 aLen, + nsString& oLinePostfix, + nsString& oLinePrefix) = 0; +}; + + +#endif /* nsILineBreaker_h__ */ diff --git a/intl/lwbrk/public/nsILineBreakerFactory.h b/intl/lwbrk/public/nsILineBreakerFactory.h new file mode 100644 index 00000000000..a0f50ce1129 --- /dev/null +++ b/intl/lwbrk/public/nsILineBreakerFactory.h @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsILineBreakerFactory_h__ +#define nsILineBreakerFactory_h__ + + +#include "nsISupports.h" +#include "nsILineBreaker.h" + +#include "nscore.h" + + +// {E86B3377-BF89-11d2-B3AF-00805F8A6670} +#define NS_ILINEBREAKERFACTORY_IID \ +{ 0xe86b3377, 0xbf89, 0x11d2, \ + { 0xb3, 0xaf, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }; + +class nsILineBreakerFactory : public nsISupports +{ + NS_IMETHOD GetBreaker(nsString& aParam, nsILineBreaker** breaker) = 0; +}; + + +#endif /* nsILineBreakerFactory_h__ */ diff --git a/intl/lwbrk/public/nsILinearIterator.h b/intl/lwbrk/public/nsILinearIterator.h new file mode 100644 index 00000000000..07566757692 --- /dev/null +++ b/intl/lwbrk/public/nsILinearIterator.h @@ -0,0 +1,42 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsILinearIterator_h__ +#define nsILinearIterator_h__ + + +#include "nsISupports.h" +#include "nscore.h" + +// {E86B3378-BF89-11d2-B3AF-00805F8A6670} +#define NS_ILINEARITERATOR_IID \ +{ 0xe86b3378, 0xbf89, 0x11d2, \ + { 0xb3, 0xaf, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }; + + +class nsILinearIterator : public nsISupports { + +public: + + NS_IMETHOD First() = 0; + NS_IMETHOD Next() = 0; + NS_IMETHOD Current(PRUint32 *oPosition) = 0; + NS_IMETHOD IsDone(PRBool *oResult) = 0; + +}; + +#endif /* nsILinearIterator_h__ */ diff --git a/intl/lwbrk/public/nsIWordBreaker.h b/intl/lwbrk/public/nsIWordBreaker.h new file mode 100644 index 00000000000..cb90a26ac44 --- /dev/null +++ b/intl/lwbrk/public/nsIWordBreaker.h @@ -0,0 +1,47 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsIWordBreaker_h__ +#define nsIWordBreaker_h__ + + +#include "nsISupports.h" +#include "nsILinearIterator.h" + +#include "nscore.h" + +// {E86B3379-BF89-11d2-B3AF-00805F8A6670} +#define NS_IWORDBREAKER_IID \ +{ 0xe86b3379, 0xbf89, 0x11d2, \ + { 0xb3, 0xaf, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }; + + +class nsIWordBreaker : public nsISupports +{ + NS_IMETHOD BreakInBetween(PRUnichar* aText1 , PRUint32 aTextLen1, + PRUnichar* aText2 , PRUint32 aTextLen2, + PRBool *oCanBreak) = 0; + NS_IMETHOD PostionToBoundary(PRUnichar* aText1 , PRUint32 aTextLen1, + PRUint32 *oWordBegin, + PRUint32 *oWordEnd) = 0; + NS_IMETHOD GetLinearIterator(PRUnichar* aText, PRUint32 aLen, + nsILinearIterator** iterator, + PRBool aForward = PR_TRUE, + PRBool aCanBreak = PR_TRUE) = 0; +}; + +#endif /* nsIWordBreaker_h__ */ diff --git a/intl/lwbrk/public/nsIWordBreakerFactory.h b/intl/lwbrk/public/nsIWordBreakerFactory.h new file mode 100644 index 00000000000..b7565096a96 --- /dev/null +++ b/intl/lwbrk/public/nsIWordBreakerFactory.h @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsIWordBreakerFactory_h__ +#define nsIWordBreakerFactory_h__ + + +#include "nsISupports.h" +#include "nsIWordBreaker.h" + +#include "nscore.h" + +// {E86B337A-BF89-11d2-B3AF-00805F8A6670} +#define NS_IWORDBREAKERFACTORY_IID \ +{ 0xe86b337a, 0xbf89, 0x11d2, \ + { 0xb3, 0xaf, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } }; + + +class nsIWordBreakerFactory : public nsISupports +{ + NS_IMETHOD GetBreaker(nsString& aParam, nsIWordBreaker** breaker) = 0; +}; + + +#endif /* nsIWordBreakerFactory_h__ */ diff --git a/intl/lwbrk/public/nsLWBrkCIID.h b/intl/lwbrk/public/nsLWBrkCIID.h new file mode 100644 index 00000000000..9e72734903e --- /dev/null +++ b/intl/lwbrk/public/nsLWBrkCIID.h @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsLWBrkCIID_h__ +#define nsLWBrkCIID_h__ + +// {E86B337B-BF89-11d2-B3AF-00805F8A6670} +#define NS_LWBRK_CID \ +{ 0xe86b337b, 0xbf89, 0x11d2, \ + { 0xb3, 0xaf, 0x0, 0x80, 0x5f, 0x8a, 0x66, 0x70 } } + + +#endif diff --git a/intl/lwbrk/src/Makefile.in b/intl/lwbrk/src/Makefile.in new file mode 100644 index 00000000000..f9cbfa0e27c --- /dev/null +++ b/intl/lwbrk/src/Makefile.in @@ -0,0 +1,43 @@ +#!gmake +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. + +DEPTH = ../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +MODULE = lwbrk +LIBRARY_NAME = lwbrk + +CSRCS = \ + $(NULL) + +CPPSRCS = \ + nsJISx4501LineBreaker.cpp \ + nsLWBreakerFImp.cpp \ + nsLWBrk.cpp \ + nsSampleWordBreaker.cpp \ + $(NULL) + +EXPORTS := $(addprefix $(srcdir)/, $(EXPORTS)) + +CFLAGS += -DUSE_NSREG -D__STDC__ + +REQUIRES = $(MODULE) libxpcom + +include $(topsrcdir)/config/rules.mk diff --git a/intl/lwbrk/src/jisx4051pairtable.txt b/intl/lwbrk/src/jisx4051pairtable.txt new file mode 100644 index 00000000000..94243864a3c --- /dev/null +++ b/intl/lwbrk/src/jisx4051pairtable.txt @@ -0,0 +1,286 @@ + + + +/* + + Simplification of Pair Table in JIS X 4501 + + 1. The Origion Table - in 4.1.3 + + In JIS x 4501. The pair table is defined as below + + Class of + Leading Class of Trialing Char Class + Char + + 1 2 3 4 5 6 7 8 9 10 11 12 13 13 14 14 15 16 17 18 19 20 + * # * # + 1 X X X X X X X X X X X X X X X X X X X X X E + 2 X X X X X X + 3 X X X X X X + 4 X X X X X X + 5 X X X X X X + 6 X X X X X X + 7 X X X X X X X + 8 X X X X X X E + 9 X X X X X X + 10 X X X X X X + 11 X X X X X X + 12 X X X X X X + 13 X X X X X X X + 14 X X X X X X X + 15 X X X X X X X X X + 16 X X X X X X X X + 17 X X X X X E + 18 X X X X X X X X X + 19 X E E E E E X X X X X X X X X X X X E X E E + 20 X X X X X E + + * Same Char + # Other Char + + 2. Simplified by remove the class which we do not care + + However, since we do not care about class 13(Subscript), 14(Ruby), + 19(split line note begin quote), and 20(split line note end quote) + we can simplify this par table into the following + + Class of + Leading Class of Trialing Char Class + Char + + 1 2 3 4 5 6 7 8 9 10 11 12 15 16 17 18 + + 1 X X X X X X X X X X X X X X X X + 2 X X X X X + 3 X X X X X + 4 X X X X X + 5 X X X X X + 6 X X X X X + 7 X X X X X X + 8 X X X X X X + 9 X X X X X + 10 X X X X X + 11 X X X X X + 12 X X X X X + 15 X X X X X X X X + 16 X X X X X X X + 17 X X X X X + 18 X X X X X X X X + + 3. Simplified by merged classes + + After the 2 simplification, the pair table have some duplication + a. class 2, 3, 4, 5, 6, are the same- we can merged them + b. class 10, 11, 12, 17 are the same- we can merged them + + + Class of + Leading Class of Trialing Char Class + Char + + 1 [a] 7 8 9 [b]15 16 18 + + 1 X X X X X X X X X + [a] X + 7 X X + 8 X X + 9 X + [b] X + 15 X X X X + 16 X X X + 18 X X X X + + + 4. Now we use one bit to encode weather it is breakable, and use 2 bytes + for one row, then the bit table will look like: + + 18 <- 1 + + 1 0000 0001 1111 1111 = 0x01FF + [a] 0000 0000 0000 0010 = 0x0002 + 7 0000 0000 0000 0110 = 0x0006 + 8 0000 0000 0100 0010 = 0x0042 + 9 0000 0000 0000 0010 = 0x0002 + [b] 0000 0000 0000 0010 = 0x0042 + 15 0000 0001 0101 0010 = 0x0152 + 16 0000 0001 1000 0010 = 0x0182 + 17 0000 0001 1100 0010 = 0x01C2 + +*/ + +static PRUint16 gJISx4501SimplifiedPair[9] = { + 0x01FF, 0x0002, 0x0006, 0x0042, 0x0002, 0x0042, 0x0152, 0x0182, 0x01C2 +}; + +PRBool XXXX::ClassesToPair(nsJISx4501Cls aCls1, nsJISx4501Cls aCls1) +{ + NS_ASSERTION( (aCls1 < 9) "invalid class"); + NS_ASSERTION( (aCls2 < 9) "invalid class"); + return ( 0 != (gJISx4501SimplifiedPair[aCls1] & (1L << aCls2) )); +} + + +#define X4501_IS_DIGIT(u) ((0x0030 >= (u)) && ((u) >= 0x0039)) + +nsJISx4501Cls XXXX::GetClass( + PRUnichar aChar, PRUnichar aBefore = 0, PRUnichar aAfter = 0) +{ + // take care the special case in cls 15 + if( ((0x2C == aChar) || (0x2E == aChar)) && + (X4501_IS_DIGIT(aBefore)) && X4501_IS_DIGIT(aAfter))) + { + return kJISx4501Cls_15; + } + + nsJISx4501Cls cls; + if(gSingle->Lookup(aChar, &cls)) + return cls; + + if(gRange->Lookup(aChar, &cls)) + return cls; + + return kJISx4501Cls_15; +} + + +typedef enum { + kJISx4501Cls_1 = 0, + kJISx4501Cls_2 = 1, + kJISx4501Cls_3 = 1, + kJISx4501Cls_4 = 1, + kJISx4501Cls_5 = 1, + kJISx4501Cls_6 = 1, + kJISx4501Cls_7 = 2, + kJISx4501Cls_8 = 3, + kJISx4501Cls_9 = 4, + kJISx4501Cls_10 = 5, + kJISx4501Cls_11 = 5, + kJISx4501Cls_12 = 5, + // kJISx4501Cls_13 = 0, + // kJISx4501Cls_14 = 0, + kJISx4501Cls_15 = 6, + kJISx4501Cls_16 = 7, + kJISx4501Cls_17 = 5, + kJISx4501Cls_18 = 8, + // kJISx4501Cls_19 = 0, + // kJISx4501Cls_20 = 0 +} nsJISx4501Cls; + + + // Table 2 + YYYY(kJISx4501Cls_1 , 0x0028), + YYYY(kJISx4501Cls_1 , 0x005B), + YYYY(kJISx4501Cls_1 , 0x007B), + YYYY(kJISx4501Cls_1 , 0x2018), + YYYY(kJISx4501Cls_1 , 0x201B), + YYYY(kJISx4501Cls_1 , 0x201C), + YYYY(kJISx4501Cls_1 , 0x201F), + YYYY(kJISx4501Cls_1 , 0x3008), + YYYY(kJISx4501Cls_1 , 0x300A), + YYYY(kJISx4501Cls_1 , 0x300C), + YYYY(kJISx4501Cls_1 , 0x300E), + YYYY(kJISx4501Cls_1 , 0x3010), + YYYY(kJISx4501Cls_1 , 0x3014), + YYYY(kJISx4501Cls_1 , 0x3016), + YYYY(kJISx4501Cls_1 , 0x3018), + YYYY(kJISx4501Cls_1 , 0x301A), + YYYY(kJISx4501Cls_1 , 0x301D), + + // Table 3 + YYYY(kJISx4501Cls_2 , 0x0029), + YYYY(kJISx4501Cls_2 , 0x002C), + YYYY(kJISx4501Cls_2 , 0x005D), + YYYY(kJISx4501Cls_2 , 0x007D), + YYYY(kJISx4501Cls_2 , 0x2019), + YYYY(kJISx4501Cls_2 , 0x201A), + YYYY(kJISx4501Cls_2 , 0x201D), + YYYY(kJISx4501Cls_2 , 0x201E), + YYYY(kJISx4501Cls_2 , 0x3001), + YYYY(kJISx4501Cls_2 , 0x3009), + YYYY(kJISx4501Cls_2 , 0x300B), + YYYY(kJISx4501Cls_2 , 0x300D), + YYYY(kJISx4501Cls_2 , 0x300F), + YYYY(kJISx4501Cls_2 , 0x3011), + YYYY(kJISx4501Cls_2 , 0x3015), + YYYY(kJISx4501Cls_2 , 0x3017), + YYYY(kJISx4501Cls_2 , 0x3019), + YYYY(kJISx4501Cls_2 , 0x301B), + YYYY(kJISx4501Cls_2 , 0x301E), + YYYY(kJISx4501Cls_2 , 0x301F), + + // Table 4 + YYYY(kJISx4501Cls_3 , 0x203C), + YYYY(kJISx4501Cls_3 , 0x2044), + YYYY(kJISx4501Cls_3 , 0x301C), + YYYY(kJISx4501Cls_3 , 0x3041), + YYYY(kJISx4501Cls_3 , 0x3043), + YYYY(kJISx4501Cls_3 , 0x3045), + YYYY(kJISx4501Cls_3 , 0x3047), + YYYY(kJISx4501Cls_3 , 0x3049), + YYYY(kJISx4501Cls_3 , 0x3063), + YYYY(kJISx4501Cls_3 , 0x3083), + YYYY(kJISx4501Cls_3 , 0x3085), + YYYY(kJISx4501Cls_3 , 0x3087), + YYYY(kJISx4501Cls_3 , 0x308E), + YYYY(kJISx4501Cls_3 , 0x309D), + YYYY(kJISx4501Cls_3 , 0x309E), + YYYY(kJISx4501Cls_3 , 0x30A1), + YYYY(kJISx4501Cls_3 , 0x30A3), + YYYY(kJISx4501Cls_3 , 0x30A5), + YYYY(kJISx4501Cls_3 , 0x30A7), + YYYY(kJISx4501Cls_3 , 0x30A9), + YYYY(kJISx4501Cls_3 , 0x30C3), + YYYY(kJISx4501Cls_3 , 0x30E3), + YYYY(kJISx4501Cls_3 , 0x30E5), + YYYY(kJISx4501Cls_3 , 0x30E7), + YYYY(kJISx4501Cls_3 , 0x30EE), + YYYY(kJISx4501Cls_3 , 0x30F5), + YYYY(kJISx4501Cls_3 , 0x30F6), + YYYY(kJISx4501Cls_3 , 0x30FC), + YYYY(kJISx4501Cls_3 , 0x30FD), + YYYY(kJISx4501Cls_3 , 0x30FE), + + // Table 5 + YYYY(kJISx4501Cls_4 , 0x0021), + YYYY(kJISx4501Cls_4 , 0x003F), + + // Table 6 + YYYY(kJISx4501Cls_5 , 0x003A), + YYYY(kJISx4501Cls_5 , 0x003B), + YYYY(kJISx4501Cls_5 , 0x30FB), + + // Table 7 + YYYY(kJISx4501Cls_6 , 0x002E), + YYYY(kJISx4501Cls_6 , 0x3002), + + // Table 8 + YYYY(kJISx4501Cls_7 , 0x2014), + YYYY(kJISx4501Cls_7 , 0x2024), + YYYY(kJISx4501Cls_7 , 0x2025), + YYYY(kJISx4501Cls_7 , 0x2026), + + // Table 9 + YYYY(kJISx4501Cls_8 , 0x0024), + YYYY(kJISx4501Cls_8 , 0x00A3), + YYYY(kJISx4501Cls_8 , 0x00A5), + YYYY(kJISx4501Cls_8 , 0x2116), + + // Table 10 + YYYY(kJISx4501Cls_9 , 0x0025), + YYYY(kJISx4501Cls_9 , 0x00A2), + YYYY(kJISx4501Cls_9 , 0x00B0), + YYYY(kJISx4501Cls_9 , 0x2030), + YYYY(kJISx4501Cls_9 , 0x2031), + YYYY(kJISx4501Cls_9 , 0x2032), + YYYY(kJISx4501Cls_9 , 0x2033), + + // Table 1 + YYYY(kJISx4501Cls_10, 0x3000), + + // Table 1 + ZZZZ(kJISx4501Cls_11, 0x3000), + + + + diff --git a/intl/lwbrk/src/makefile.win b/intl/lwbrk/src/makefile.win new file mode 100644 index 00000000000..7d611c408b9 --- /dev/null +++ b/intl/lwbrk/src/makefile.win @@ -0,0 +1,70 @@ +#!nmake +# +# The contents of this file are subject to the Netscape Public License +# Version 1.0 (the "NPL"); you may not use this file except in +# compliance with the NPL. You may obtain a copy of the NPL at +# http://www.mozilla.org/NPL/ +# +# Software distributed under the NPL is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL +# for the specific language governing rights and limitations under the +# NPL. +# +# The Initial Developer of this code under the NPL is Netscape +# Communications Corporation. Portions created by Netscape are +# Copyright (C) 1998 Netscape Communications Corporation. All Rights +# Reserved. +DEPTH=..\..\.. +IGNORE_MANIFEST=1 + +LCFLAGS= $(LCFLAGS) -D__STDC__ + +DEFINES= -DWIN32_LEAN_AND_MEAN +LIBRARY_NAME= lwbrk + +OBJS= \ + $(NULL) + +CSRCS= \ + $(NULL) + +CPPSRCS= \ + nsJISx4501LineBreaker.cpp \ + nsLWBreakerFImp.cpp \ + nsLWBrk.cpp \ + nsSampleWordBreaker.cpp \ + $(NULL) + +CPP_OBJS= \ + .\$(OBJDIR)\nsJISx4501LineBreaker.obj \ + .\$(OBJDIR)\nsLWBreakerFImp.obj \ + .\$(OBJDIR)\nsLWBrk.obj \ + .\$(OBJDIR)\nsSampleWordBreaker.obj \ + $(NULL) + +MODULE=lwbrk + +REQUIRES=xpcom + +INCS=-I$(PUBLIC)\xpcom -I$(PUBLIC)\lwbrk -I$(PUBLIC)\raptor + +MAKE_OBJ_TYPE=DLL +DLLNAME=lwbrk +DLL=.\$(OBJDIR)\$(DLLNAME).dll + + +LLIBS= \ + $(DIST)\lib\xpcom32.lib \ + $(DIST)\lib\libplc21.lib \ + $(DIST)\lib\raptorbase.lib \ + $(LIBNSPR) + +include <$(DEPTH)\config\rules.mak> + +libs:: $(DLL) + $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).dll $(DIST)\bin + $(MAKE_INSTALL) .\$(OBJDIR)\$(DLLNAME).lib $(DIST)\lib + +clobber:: + rm -f $(DIST)\bin\$(DLLNAME).dll + rm -f $(DIST)\bin\$(DLLNAME).lib diff --git a/intl/lwbrk/src/nsJISx4501LineBreaker.cpp b/intl/lwbrk/src/nsJISx4501LineBreaker.cpp new file mode 100644 index 00000000000..ec84881db68 --- /dev/null +++ b/intl/lwbrk/src/nsJISx4501LineBreaker.cpp @@ -0,0 +1,70 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + + +#include "nsJISx4501LineBreaker.h" + +NS_DEFINE_IID(kILineBreaker, NS_ILINEBREAKER_IID); + +NS_IMPL_ISUPPORTS(nsJISx4501LineBreaker, NS_ILINEBREAKER_IID); + + + + + + + +nsresult nsJISx4501LineBreaker::BreakInBetween( + PRUnichar* aText1 , PRUint32 aTextLen1, + PRUnichar* aText2 , PRUint32 aTextLen2, + PRBool *oCanBreak) +{ + + // to be implement + return NS_OK; +} + + +nsresult nsJISx4501LineBreaker::GetLinearIterator( + PRUnichar* aText, PRUint32 aLen, + nsILinearIterator** iterator, + PRBool aForward, + PRBool aCanBreak) +{ + // to be implement + return NS_OK; +} + +nsresult nsJISx4501LineBreaker::GetBinarySearchIterator( + PRUnichar* aText, PRUint32 aLen, + nsIBinarySearchIterator** iterator) +{ + // to be implement + return NS_OK; +} + +nsresult nsJISx4501LineBreaker::GetConnector( + PRUnichar* aText, PRUint32 aLen, + nsString& oLinePostfix, + nsString& oLinePrefix ) +{ + // we don't support hyphen, so always return "" as prefix and postfix + oLinePrefix= ""; + oLinePostfix= ""; + return NS_OK; +} diff --git a/intl/lwbrk/src/nsJISx4501LineBreaker.h b/intl/lwbrk/src/nsJISx4501LineBreaker.h new file mode 100644 index 00000000000..be4cc30b085 --- /dev/null +++ b/intl/lwbrk/src/nsJISx4501LineBreaker.h @@ -0,0 +1,49 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsJISx4501LineBreaker_h__ +#define nsJISx4501LineBreaker_h__ + + +#include "nsILineBreaker.h" + +class nsJISx4501LineBreaker : public nsILineBreaker +{ + NS_DECL_ISUPPORTS + + nsJISx4501LineBreaker() { + NS_INIT_REFCNT(); + } + + NS_IMETHOD BreakInBetween(PRUnichar* aText1 , PRUint32 aTextLen1, + PRUnichar* aText2 , PRUint32 aTextLen2, + PRBool *oCanBreak); + + NS_IMETHOD GetLinearIterator(PRUnichar* aText, PRUint32 aLen, + nsILinearIterator** iterator, + PRBool aForward = PR_TRUE, + PRBool aCanBreak = PR_TRUE); + + NS_IMETHOD GetBinarySearchIterator(PRUnichar* aText, PRUint32 aLen, + nsIBinarySearchIterator** iterator); + + NS_IMETHOD GetConnector(PRUnichar* aText, PRUint32 aLen, + nsString& oLinePostfix, + nsString& oLinePrefix); +}; + +#endif /* nsJISx4501LineBreaker_h__ */ diff --git a/intl/lwbrk/src/nsLWBreakerFImp.cpp b/intl/lwbrk/src/nsLWBreakerFImp.cpp new file mode 100644 index 00000000000..6b7b9df8229 --- /dev/null +++ b/intl/lwbrk/src/nsLWBreakerFImp.cpp @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "nsLWBreakerFImp.h" + +#include "nsLWIMP.h" + + +NS_DEFINE_IID(kILineBreakerFactoryIID, NS_ILINEBREAKERFACTORY_IID); +NS_DEFINE_IID(kIWordBreakerFactoryIID, NS_ILINEBREAKERFACTORY_IID); +NS_DEFINE_IID(kILineBreakerIID, NS_ILINEBREAKER_IID); +NS_DEFINE_IID(kIWordBreakerIID, NS_ILINEBREAKER_IID); + + +NS_IMPL_ADDREF ( nsLWBreakerFImp ); +NS_IMPL_RELEASE ( nsLWBreakerFImp ); + +nsresult nsLWBreakerFImp::QueryInterface(REFNSIID aIID, void** aInstancePtr) +{ + + if( NULL == aInstancePtr) { + return NS_ERROR_NULL_POINTER; + } + *aInstancePtr = NULL; + + if( aIID.Equals ( kILineBreakerFactoryIID )) { + *aInstancePtr = (void*) ((nsILineBreakerFactory*) this); + NS_ADDREF_THIS(); + return NS_OK; + } + if( aIID.Equals ( kIWordBreakerFactoryIID )) { + *aInstancePtr = (void*) ((nsIWordBreakerFactory*) this); + NS_ADDREF_THIS(); + return NS_OK; + } + static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); + + if( aIID.Equals ( kISupportsIID )) { + *aInstancePtr = (void*) (this); + NS_ADDREF_THIS(); + return NS_OK; + } + return NS_NOINTERFACE; +} + +nsresult nsLWBreakerFImp::GetBreaker(nsString& aParam, nsILineBreaker** oResult) +{ + if( NULL == oResult) { + return NS_ERROR_NULL_POINTER; + } + *oResult = new LINEBREAKER (); + return (*oResult)->AddRef(); +} + +nsresult nsLWBreakerFImp::GetBreaker(nsString& aParam, nsIWordBreaker** oResult) +{ + if( NULL == oResult) { + return NS_ERROR_NULL_POINTER; + } + *oResult = new WORDBREAKER (); + return (*oResult)->AddRef(); +} + diff --git a/intl/lwbrk/src/nsLWBreakerFImp.h b/intl/lwbrk/src/nsLWBreakerFImp.h new file mode 100644 index 00000000000..5a0a48ae910 --- /dev/null +++ b/intl/lwbrk/src/nsLWBreakerFImp.h @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsLWBreakerFImp_h__ +#define nsLWBreakerFImp_h__ + + +#include "nsCom.h" +#include "nsISupports.h" + +#include "nsILineBreakerFactory.h" +#include "nsILineBreaker.h" +#include "nsIWordBreakerFactory.h" +#include "nsIWordBreaker.h" + + +class nsLWBreakerFImp : public nsILineBreakerFactory , nsIWordBreakerFactory +{ + NS_DECL_ISUPPORTS + +public: + + nsLWBreakerFImp() { + NS_INIT_REFCNT(); + } + + NS_IMETHOD GetBreaker(nsString& aParam, nsILineBreaker** breaker); + NS_IMETHOD GetBreaker(nsString& aParam, nsIWordBreaker** breaker); +}; + + +#endif /* nsLWBreakerFImp_h__ */ diff --git a/intl/lwbrk/src/nsLWBrk.cpp b/intl/lwbrk/src/nsLWBrk.cpp new file mode 100644 index 00000000000..c7b360e127a --- /dev/null +++ b/intl/lwbrk/src/nsLWBrk.cpp @@ -0,0 +1,115 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#include "pratom.h" +#include "nsISupports.h" +#include "nsRepository.h" +#include "nsIFactory.h" +#include "nsLWBrkCIID.h" +#include "nsILineBreakerFactory.h" +#include "nsIWordBreakerFactory.h" +#include "nsLWBreakerFImp.h" + + +NS_DEFINE_CID(kLWBrkCID, NS_LWBRK_CID); + +NS_DEFINE_IID(kFactoryIID, NS_IFACTORY_IID); +NS_DEFINE_IID(kILineBreakerFactoryIID, NS_ILINEBREAKERFACTORY_IID); +NS_DEFINE_IID(kIWordBreakerFactoryIID, NS_IWORDBREAKERFACTORY_IID); + +static PRInt32 g_FactoryCount = 0; +static PRInt32 g_LockCount = 0; + +class nsLWBrkFactory : public nsIFactory { + NS_DECL_ISUPPORTS + nsLWBrkFactory() { + NS_INIT_REFCNT(); + PR_AtomicIncrement(&g_FactoryCount); + }; + ~nsLWBrkFactory() { + PR_AtomicDecrement(&g_FactoryCount); + }; + + NS_IMETHOD CreateInstance(nsISupports *aDelegate, + const nsIID &aIID, + void **aResult); + + NS_IMETHOD LockFactory(PRBool aLock) { + if (aLock) { + PR_AtomicIncrement(&g_LockCount); + } else { + PR_AtomicDecrement(&g_LockCount); + } + return NS_OK; + }; +}; + +NS_IMPL_ISUPPORTS(nsLWBrkFactory, kFactoryIID); + +nsresult nsLWBrkFactory::CreateInstance(nsISupports *aDelegate, + const nsIID &aIID, + void **aResult) +{ + if(NULL == aResult ) { + return NS_ERROR_NULL_POINTER; + } + + *aResult = NULL; + + nsLWBreakerFImp *imp = new nsLWBreakerFImp() ; + + nsresult res = imp->QueryInterface(aIID, aResult); + + if(NS_FAILED(res)) { + delete imp; + } + return res; +} + +extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aCID, nsISupports* serviceMgr, + nsIFactory **aFactory) +{ + if (aFactory == NULL) { + return NS_ERROR_NULL_POINTER; + } + if (aCID.Equals(kLWBrkCID)) { + nsLWBrkFactory *factory = new nsLWBrkFactory(); + nsresult res = factory->QueryInterface(kFactoryIID, (void **) aFactory); + if (NS_FAILED(res)) { + *aFactory = NULL; + delete factory; + } + return res; + } + return NS_NOINTERFACE; +} + +extern "C" NS_EXPORT PRBool NSCanUnload() { + return PRBool(g_FactoryCount == 0 && g_LockCount == 0); +} + +extern "C" NS_EXPORT nsresult NSRegisterSelf(const char *path) +{ + return nsRepository::RegisterFactory(kLWBrkCID, path, + PR_TRUE, PR_TRUE); +} + +extern "C" NS_EXPORT nsresult NSUnregisterSelf(const char *path) +{ + return nsRepository::UnregisterFactory(kLWBrkCID, path); +} diff --git a/intl/lwbrk/src/nsLWIMP.h b/intl/lwbrk/src/nsLWIMP.h new file mode 100644 index 00000000000..ff482e1de8b --- /dev/null +++ b/intl/lwbrk/src/nsLWIMP.h @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsLWIMP_h__ +#define nsLWIMP_h__ + +#include "nsJISx4501LineBreaker.h" +#include "nsSampleWordBreaker.h" + +#define LINEBREAKER nsJISx4501LineBreaker +#define WORDBREAKER nsSampleWordBreaker + +#endif /* nsLWIMP_h__ */ diff --git a/intl/lwbrk/src/nsSampleWordBreaker.cpp b/intl/lwbrk/src/nsSampleWordBreaker.cpp new file mode 100644 index 00000000000..e0683441450 --- /dev/null +++ b/intl/lwbrk/src/nsSampleWordBreaker.cpp @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ + + +#include "nsSampleWordBreaker.h" + +NS_DEFINE_IID(kIWordBreaker, NS_IWORDBREAKER_IID); + +NS_IMPL_ISUPPORTS(nsSampleWordBreaker, NS_IWORDBREAKER_IID); + +nsresult nsSampleWordBreaker::BreakInBetween( + PRUnichar* aText1 , PRUint32 aTextLen1, + PRUnichar* aText2 , PRUint32 aTextLen2, + PRBool *oCanBreak) +{ + // to be implement + return NS_OK; +} + +nsresult nsSampleWordBreaker::PostionToBoundary( + PRUnichar* aText1 , PRUint32 aTextLen1, + PRUint32 *oWordBegin, + PRUint32 *oWordEnd) +{ + // to be implement + return NS_OK; +} + +nsresult nsSampleWordBreaker::GetLinearIterator( + PRUnichar* aText, PRUint32 aLen, + nsILinearIterator** iterator, + PRBool aForward, + PRBool aCanBreak) +{ + // to be implement + return NS_OK; +} + diff --git a/intl/lwbrk/src/nsSampleWordBreaker.h b/intl/lwbrk/src/nsSampleWordBreaker.h new file mode 100644 index 00000000000..2849625d2b3 --- /dev/null +++ b/intl/lwbrk/src/nsSampleWordBreaker.h @@ -0,0 +1,44 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All Rights + * Reserved. + */ +#ifndef nsSampleWordBreaker_h__ +#define nsSampleWordBreaker_h__ + + +#include "nsIWordBreaker.h" + +class nsSampleWordBreaker : public nsIWordBreaker +{ + NS_DECL_ISUPPORTS + + nsSampleWordBreaker() { + NS_INIT_REFCNT(); + } + + NS_IMETHOD BreakInBetween(PRUnichar* aText1 , PRUint32 aTextLen1, + PRUnichar* aText2 , PRUint32 aTextLen2, + PRBool *oCanBreak); + NS_IMETHOD PostionToBoundary(PRUnichar* aText1 , PRUint32 aTextLen1, + PRUint32 *oWordBegin, + PRUint32 *oWordEnd); + NS_IMETHOD GetLinearIterator(PRUnichar* aText, PRUint32 aLen, + nsILinearIterator** iterator, + PRBool aForward = PR_TRUE, + PRBool aCanBreak = PR_TRUE); +}; + +#endif /* nsSampleWordBreaker_h__ */