merged tag ooo/OOO330_m14
[LibreOffice.git] / unoxml / source / rdf / CURI.cxx
blob03ce858726353a1853a6419459676461b137b65f
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * This file is part of OpenOffice.org.
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org. If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
26 ************************************************************************/
28 #include "CNodes.hxx"
30 #include <cppuhelper/implbase3.hxx>
31 #include <com/sun/star/lang/XServiceInfo.hpp>
32 #include <com/sun/star/lang/XInitialization.hpp>
33 #include <com/sun/star/rdf/XURI.hpp>
34 #include <com/sun/star/rdf/URIs.hpp>
36 #include <com/sun/star/lang/IllegalArgumentException.hpp>
39 /// anonymous implementation namespace
40 namespace {
42 namespace css = ::com::sun::star;
44 class CURI:
45 public ::cppu::WeakImplHelper3<
46 css::lang::XServiceInfo,
47 css::lang::XInitialization,
48 css::rdf::XURI>
50 public:
51 explicit CURI(css::uno::Reference< css::uno::XComponentContext > const & context);
52 virtual ~CURI() {}
54 // ::com::sun::star::lang::XServiceInfo:
55 virtual ::rtl::OUString SAL_CALL getImplementationName() throw (css::uno::RuntimeException);
56 virtual ::sal_Bool SAL_CALL supportsService(const ::rtl::OUString & ServiceName) throw (css::uno::RuntimeException);
57 virtual css::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (css::uno::RuntimeException);
59 // ::com::sun::star::lang::XInitialization:
60 virtual void SAL_CALL initialize(const css::uno::Sequence< ::com::sun::star::uno::Any > & aArguments) throw (css::uno::RuntimeException, css::uno::Exception);
62 // ::com::sun::star::rdf::XNode:
63 virtual ::rtl::OUString SAL_CALL getStringValue() throw (css::uno::RuntimeException);
65 // ::com::sun::star::rdf::XURI:
66 virtual ::rtl::OUString SAL_CALL getLocalName() throw (css::uno::RuntimeException);
67 virtual ::rtl::OUString SAL_CALL getNamespace() throw (css::uno::RuntimeException);
69 private:
70 CURI(const CURI &); // not defined
71 CURI& operator=(const CURI &); // not defined
73 /// handle css.rdf.URIs
74 void SAL_CALL initFromConstant(const sal_Int16 i_Constant);
76 css::uno::Reference< css::uno::XComponentContext > m_xContext;
78 ::rtl::OUString m_Namespace;
79 ::rtl::OUString m_LocalName;
82 CURI::CURI(css::uno::Reference< css::uno::XComponentContext > const & context) :
83 m_xContext(context), m_Namespace(), m_LocalName()
86 // com.sun.star.uno.XServiceInfo:
87 ::rtl::OUString SAL_CALL CURI::getImplementationName() throw (css::uno::RuntimeException)
89 return comp_CURI::_getImplementationName();
92 ::sal_Bool SAL_CALL CURI::supportsService(::rtl::OUString const & serviceName) throw (css::uno::RuntimeException)
94 css::uno::Sequence< ::rtl::OUString > serviceNames = comp_CURI::_getSupportedServiceNames();
95 for (::sal_Int32 i = 0; i < serviceNames.getLength(); ++i) {
96 if (serviceNames[i] == serviceName)
97 return sal_True;
99 return sal_False;
102 css::uno::Sequence< ::rtl::OUString > SAL_CALL CURI::getSupportedServiceNames() throw (css::uno::RuntimeException)
104 return comp_CURI::_getSupportedServiceNames();
107 const char s_nsXS [] = "http://www.w3.org/2001/XMLSchema#";
108 const char s_nsXSD [] = "http://www.w3.org/2001/XMLSchema-datatypes#";
109 const char s_nsRDF [] = "http://www.w3.org/1999/02/22-rdf-syntax-ns#";
110 const char s_nsRDFs [] = "http://www.w3.org/2000/01/rdf-schema#";
111 const char s_nsOWL [] = "http://www.w3.org/2002/07/owl#";
112 const char s_nsPkg [] =
113 "http://docs.oasis-open.org/ns/office/1.2/meta/pkg#";
114 const char s_nsODF [] =
115 "http://docs.oasis-open.org/ns/office/1.2/meta/odf#";
117 void SAL_CALL CURI::initFromConstant(const sal_Int16 i_Constant)
119 const char *ns(0);
120 const char *ln(0);
121 switch (i_Constant)
123 case css::rdf::URIs::XSD_NCNAME:
124 ns = s_nsXSD;
125 ln = "NCName";
126 break;
128 case css::rdf::URIs::XSD_STRING:
129 ns = s_nsXSD;
130 ln = "string";
131 break;
133 case css::rdf::URIs::XSD_NORMALIZEDSTRING:
134 ns = s_nsXSD;
135 ln = "normalizedString";
136 break;
138 case css::rdf::URIs::XSD_BOOLEAN:
139 ns = s_nsXSD;
140 ln = "boolean";
141 break;
143 case css::rdf::URIs::XSD_DECIMAL:
144 ns = s_nsXSD;
145 ln = "decimal";
146 break;
148 case css::rdf::URIs::XSD_FLOAT:
149 ns = s_nsXSD;
150 ln = "float";
151 break;
153 case css::rdf::URIs::XSD_DOUBLE:
154 ns = s_nsXSD;
155 ln = "double";
156 break;
158 case css::rdf::URIs::XSD_INTEGER:
159 ns = s_nsXSD;
160 ln = "integer";
161 break;
163 case css::rdf::URIs::XSD_NONNEGATIVEINTEGER:
164 ns = s_nsXSD;
165 ln = "nonNegativeInteger";
166 break;
168 case css::rdf::URIs::XSD_POSITIVEINTEGER:
169 ns = s_nsXSD;
170 ln = "positiveInteger";
171 break;
173 case css::rdf::URIs::XSD_NONPOSITIVEINTEGER:
174 ns = s_nsXSD;
175 ln = "nonPositiveInteger";
176 break;
178 case css::rdf::URIs::XSD_NEGATIVEINTEGER:
179 ns = s_nsXSD;
180 ln = "negativeInteger";
181 break;
183 case css::rdf::URIs::XSD_LONG:
184 ns = s_nsXSD;
185 ln = "long";
186 break;
188 case css::rdf::URIs::XSD_INT:
189 ns = s_nsXSD;
190 ln = "int";
191 break;
193 case css::rdf::URIs::XSD_SHORT:
194 ns = s_nsXSD;
195 ln = "short";
196 break;
198 case css::rdf::URIs::XSD_BYTE:
199 ns = s_nsXSD;
200 ln = "byte";
201 break;
203 case css::rdf::URIs::XSD_UNSIGNEDLONG:
204 ns = s_nsXSD;
205 ln = "unsignedLong";
206 break;
208 case css::rdf::URIs::XSD_UNSIGNEDINT:
209 ns = s_nsXSD;
210 ln = "unsignedInt";
211 break;
213 case css::rdf::URIs::XSD_UNSIGNEDSHORT:
214 ns = s_nsXSD;
215 ln = "unsignedShort";
216 break;
218 case css::rdf::URIs::XSD_UNSIGNEDBYTE:
219 ns = s_nsXSD;
220 ln = "unsignedByte";
221 break;
223 case css::rdf::URIs::XSD_HEXBINARY:
224 ns = s_nsXSD;
225 ln = "hexBinary";
226 break;
228 case css::rdf::URIs::XSD_BASE64BINARY:
229 ns = s_nsXSD;
230 ln = "base64Binary";
231 break;
233 case css::rdf::URIs::XSD_DATETIME:
234 ns = s_nsXSD;
235 ln = "dateTime";
236 break;
238 case css::rdf::URIs::XSD_TIME:
239 ns = s_nsXSD;
240 ln = "time";
241 break;
243 case css::rdf::URIs::XSD_DATE:
244 ns = s_nsXSD;
245 ln = "date";
246 break;
248 case css::rdf::URIs::XSD_GYEARMONTH:
249 ns = s_nsXSD;
250 ln = "gYearMonth";
251 break;
253 case css::rdf::URIs::XSD_GYEAR:
254 ns = s_nsXSD;
255 ln = "gYear";
256 break;
258 case css::rdf::URIs::XSD_GMONTHDAY:
259 ns = s_nsXSD;
260 ln = "gMonthDay";
261 break;
263 case css::rdf::URIs::XSD_GDAY:
264 ns = s_nsXSD;
265 ln = "gDay";
266 break;
268 case css::rdf::URIs::XSD_GMONTH:
269 ns = s_nsXSD;
270 ln = "gMonth";
271 break;
273 case css::rdf::URIs::XSD_ANYURI:
274 ns = s_nsXSD;
275 ln = "anyURI";
276 break;
278 case css::rdf::URIs::XSD_TOKEN:
279 ns = s_nsXSD;
280 ln = "token";
281 break;
283 case css::rdf::URIs::XSD_LANGUAGE:
284 ns = s_nsXSD;
285 ln = "language";
286 break;
288 case css::rdf::URIs::XSD_NMTOKEN:
289 ns = s_nsXSD;
290 ln = "NMTOKEN";
291 break;
293 case css::rdf::URIs::XSD_NAME:
294 ns = s_nsXSD;
295 ln = "Name";
296 break;
298 case css::rdf::URIs::XSD_DURATION:
299 ns = s_nsXSD;
300 ln = "duration";
301 break;
303 case css::rdf::URIs::XSD_QNAME:
304 ns = s_nsXSD;
305 ln = "QName";
306 break;
308 case css::rdf::URIs::XSD_NOTATION:
309 ns = s_nsXSD;
310 ln = "NOTATION";
311 break;
313 case css::rdf::URIs::XSD_NMTOKENS:
314 ns = s_nsXSD;
315 ln = "NMTOKENS";
316 break;
318 case css::rdf::URIs::XSD_ID:
319 ns = s_nsXSD;
320 ln = "ID";
321 break;
323 case css::rdf::URIs::XSD_IDREF:
324 ns = s_nsXSD;
325 ln = "IDREF";
326 break;
328 case css::rdf::URIs::XSD_IDREFS:
329 ns = s_nsXSD;
330 ln = "IDREFS";
331 break;
333 case css::rdf::URIs::XSD_ENTITY:
334 ns = s_nsXSD;
335 ln = "ENTITY";
336 break;
338 case css::rdf::URIs::XSD_ENTITIES:
339 ns = s_nsXSD;
340 ln = "ENTITIES";
341 break;
343 case css::rdf::URIs::RDF_TYPE:
344 ns = s_nsRDF;
345 ln = "type";
346 break;
348 case css::rdf::URIs::RDF_SUBJECT:
349 ns = s_nsRDF;
350 ln = "subject";
351 break;
353 case css::rdf::URIs::RDF_PREDICATE:
354 ns = s_nsRDF;
355 ln = "predicate";
356 break;
358 case css::rdf::URIs::RDF_OBJECT:
359 ns = s_nsRDF;
360 ln = "object";
361 break;
363 case css::rdf::URIs::RDF_PROPERTY:
364 ns = s_nsRDF;
365 ln = "Property";
366 break;
368 case css::rdf::URIs::RDF_STATEMENT:
369 ns = s_nsRDF;
370 ln = "Statement";
371 break;
373 case css::rdf::URIs::RDF_VALUE:
374 ns = s_nsRDF;
375 ln = "value";
376 break;
378 case css::rdf::URIs::RDF_FIRST:
379 ns = s_nsRDF;
380 ln = "first";
381 break;
383 case css::rdf::URIs::RDF_REST:
384 ns = s_nsRDF;
385 ln = "rest";
386 break;
388 case css::rdf::URIs::RDF_NIL:
389 ns = s_nsRDF;
390 ln = "nil";
391 break;
393 case css::rdf::URIs::RDF_XMLLITERAL:
394 ns = s_nsRDF;
395 ln = "XMLLiteral";
396 break;
398 case css::rdf::URIs::RDF_ALT:
399 ns = s_nsRDF;
400 ln = "Alt";
401 break;
403 case css::rdf::URIs::RDF_BAG:
404 ns = s_nsRDF;
405 ln = "Bag";
406 break;
408 case css::rdf::URIs::RDF_LIST:
409 ns = s_nsRDF;
410 ln = "List";
411 break;
413 case css::rdf::URIs::RDF_SEQ:
414 ns = s_nsRDF;
415 ln = "Seq";
416 break;
418 case css::rdf::URIs::RDF_1:
419 ns = s_nsRDF;
420 ln = "_1";
421 break;
423 case css::rdf::URIs::RDFS_COMMENT:
424 ns = s_nsRDFs;
425 ln = "comment";
426 break;
428 case css::rdf::URIs::RDFS_LABEL:
429 ns = s_nsRDFs;
430 ln = "label";
431 break;
433 case css::rdf::URIs::RDFS_DOMAIN:
434 ns = s_nsRDFs;
435 ln = "domain";
436 break;
438 case css::rdf::URIs::RDFS_RANGE:
439 ns = s_nsRDFs;
440 ln = "range";
441 break;
443 case css::rdf::URIs::RDFS_SUBCLASSOF:
444 ns = s_nsRDFs;
445 ln = "subClassOf";
446 break;
448 case css::rdf::URIs::RDFS_LITERAL:
449 ns = s_nsRDFs;
450 ln = "Literal";
451 break;
453 case css::rdf::URIs::OWL_CLASS:
454 ns = s_nsOWL;
455 ln = "Class";
456 break;
458 case css::rdf::URIs::OWL_OBJECTPROPERTY:
459 ns = s_nsOWL;
460 ln = "ObjectProperty";
461 break;
463 case css::rdf::URIs::OWL_DATATYPEPROPERTY:
464 ns = s_nsOWL;
465 ln = "DatatypeProperty";
466 break;
468 case css::rdf::URIs::OWL_FUNCTIONALPROPERTY:
469 ns = s_nsOWL;
470 ln = "FunctionalProperty";
471 break;
473 case css::rdf::URIs::OWL_THING:
474 ns = s_nsOWL;
475 ln = "Thing";
476 break;
478 case css::rdf::URIs::OWL_NOTHING:
479 ns = s_nsOWL;
480 ln = "Nothing";
481 break;
483 case css::rdf::URIs::OWL_INDIVIDUAL:
484 ns = s_nsOWL;
485 ln = "Individual";
486 break;
488 case css::rdf::URIs::OWL_EQUIVALENTCLASS:
489 ns = s_nsOWL;
490 ln = "equivalentClass";
491 break;
493 case css::rdf::URIs::OWL_EQUIVALENTPROPERTY:
494 ns = s_nsOWL;
495 ln = "equivalentProperty";
496 break;
498 case css::rdf::URIs::OWL_SAMEAS:
499 ns = s_nsOWL;
500 ln = "sameAs";
501 break;
503 case css::rdf::URIs::OWL_DIFFERENTFROM:
504 ns = s_nsOWL;
505 ln = "differentFrom";
506 break;
508 case css::rdf::URIs::OWL_ALLDIFFERENT:
509 ns = s_nsOWL;
510 ln = "AllDifferent";
511 break;
513 case css::rdf::URIs::OWL_DISTINCTMEMBERS:
514 ns = s_nsOWL;
515 ln = "distinctMembers";
516 break;
518 case css::rdf::URIs::OWL_INVERSEOF:
519 ns = s_nsOWL;
520 ln = "inverseOf";
521 break;
523 case css::rdf::URIs::OWL_TRANSITIVEPROPERTY:
524 ns = s_nsOWL;
525 ln = "TransitiveProperty";
526 break;
528 case css::rdf::URIs::OWL_SYMMETRICPROPERTY:
529 ns = s_nsOWL;
530 ln = "SymmetricProperty";
531 break;
533 case css::rdf::URIs::OWL_INVERSEFUNCTIONALPROPERTY:
534 ns = s_nsOWL;
535 ln = "InverseFunctionalProperty";
536 break;
538 case css::rdf::URIs::OWL_RESTRICTION:
539 ns = s_nsOWL;
540 ln = "Restriction";
541 break;
543 case css::rdf::URIs::OWL_ONPROPERTY:
544 ns = s_nsOWL;
545 ln = "onProperty";
546 break;
548 case css::rdf::URIs::OWL_ALLVALUESFROM:
549 ns = s_nsOWL;
550 ln = "allValuesFrom";
551 break;
553 case css::rdf::URIs::OWL_SOMEVALUESFROM:
554 ns = s_nsOWL;
555 ln = "someValuesFrom";
556 break;
558 case css::rdf::URIs::OWL_MINCARDINALITY:
559 ns = s_nsOWL;
560 ln = "minCardinality";
561 break;
563 case css::rdf::URIs::OWL_MAXCARDINALITY:
564 ns = s_nsOWL;
565 ln = "maxCardinality";
566 break;
568 case css::rdf::URIs::OWL_CARDINALITY:
569 ns = s_nsOWL;
570 ln = "cardinality";
571 break;
573 case css::rdf::URIs::OWL_ONTOLOGY:
574 ns = s_nsOWL;
575 ln = "Ontology";
576 break;
578 case css::rdf::URIs::OWL_IMPORTS:
579 ns = s_nsOWL;
580 ln = "imports";
581 break;
583 case css::rdf::URIs::OWL_VERSIONINFO:
584 ns = s_nsOWL;
585 ln = "versionInfo";
586 break;
588 case css::rdf::URIs::OWL_PRIORVERSION:
589 ns = s_nsOWL;
590 ln = "priorVersion";
591 break;
593 case css::rdf::URIs::OWL_BACKWARDCOMPATIBLEWITH:
594 ns = s_nsOWL;
595 ln = "backwardCompatibleWith";
596 break;
598 case css::rdf::URIs::OWL_INCOMPATIBLEWITH:
599 ns = s_nsOWL;
600 ln = "incompatibleWith";
601 break;
603 case css::rdf::URIs::OWL_DEPRECATEDCLASS:
604 ns = s_nsOWL;
605 ln = "DeprecatedClass";
606 break;
608 case css::rdf::URIs::OWL_DEPRECATEDPROPERTY:
609 ns = s_nsOWL;
610 ln = "DeprecatedProperty";
611 break;
613 case css::rdf::URIs::OWL_ANNOTATIONPROPERTY:
614 ns = s_nsOWL;
615 ln = "AnnotationProperty";
616 break;
618 case css::rdf::URIs::OWL_ONTOLOGYPROPERTY:
619 ns = s_nsOWL;
620 ln = "OntologyProperty";
621 break;
623 case css::rdf::URIs::OWL_ONEOF:
624 ns = s_nsOWL;
625 ln = "oneOf";
626 break;
628 case css::rdf::URIs::OWL_DATARANGE:
629 ns = s_nsOWL;
630 ln = "dataRange";
631 break;
633 case css::rdf::URIs::OWL_DISJOINTWITH:
634 ns = s_nsOWL;
635 ln = "disjointWith";
636 break;
638 case css::rdf::URIs::OWL_UNIONOF:
639 ns = s_nsOWL;
640 ln = "unionOf";
641 break;
643 case css::rdf::URIs::OWL_COMPLEMENTOF:
644 ns = s_nsOWL;
645 ln = "complementOf";
646 break;
648 case css::rdf::URIs::OWL_INTERSECTIONOF:
649 ns = s_nsOWL;
650 ln = "intersectionOf";
651 break;
653 case css::rdf::URIs::OWL_HASVALUE:
654 ns = s_nsOWL;
655 ln = "hasValue";
656 break;
659 case css::rdf::URIs::PKG_HASPART:
660 ns = s_nsPkg;
661 ln = "hasPart";
662 break;
664 /* REMOVED
665 case css::rdf::URIs::PKG_IDREF:
666 ns = s_nsPkg;
667 ln = "idref";
668 break;
670 case css::rdf::URIs::PKG_PATH:
671 ns = s_nsPkg;
672 ln = "path";
673 break;
676 case css::rdf::URIs::PKG_MIMETYPE:
677 ns = s_nsPkg;
678 ln = "mimeType";
679 break;
681 case css::rdf::URIs::PKG_PACKAGE:
682 ns = s_nsPkg;
683 ln = "Package";
684 break;
686 case css::rdf::URIs::PKG_ELEMENT:
687 ns = s_nsPkg;
688 ln = "Element";
689 break;
691 case css::rdf::URIs::PKG_FILE:
692 ns = s_nsPkg;
693 ln = "File";
694 break;
696 case css::rdf::URIs::PKG_METADATAFILE:
697 ns = s_nsPkg;
698 ln = "MetadataFile";
699 break;
701 case css::rdf::URIs::PKG_DOCUMENT:
702 ns = s_nsPkg;
703 ln = "Document";
704 break;
706 case css::rdf::URIs::ODF_PREFIX:
707 ns = s_nsODF;
708 ln = "prefix";
709 break;
711 case css::rdf::URIs::ODF_SUFFIX:
712 ns = s_nsODF;
713 ln = "suffix";
714 break;
716 case css::rdf::URIs::ODF_ELEMENT:
717 ns = s_nsODF;
718 ln = "Element";
719 break;
721 case css::rdf::URIs::ODF_CONTENTFILE:
722 ns = s_nsODF;
723 ln = "ContentFile";
724 break;
726 case css::rdf::URIs::ODF_STYLESFILE:
727 ns = s_nsODF;
728 ln = "StylesFile";
729 break;
731 /* REMOVED
732 case css::rdf::URIs::ODF_METADATAFILE:
733 ns = s_nsODF;
734 ln = "MetadataFile";
735 break;
738 default:
739 throw css::lang::IllegalArgumentException(
740 ::rtl::OUString::createFromAscii("CURI::initialize: "
741 "invalid URIs constant argument"), *this, 0);
743 m_Namespace = ::rtl::OUString::createFromAscii(ns).intern();
744 m_LocalName = ::rtl::OUString::createFromAscii(ln).intern();
745 return;
748 // ::com::sun::star::lang::XInitialization:
749 void SAL_CALL CURI::initialize(const css::uno::Sequence< ::com::sun::star::uno::Any > & aArguments) throw (css::uno::RuntimeException, css::uno::Exception)
751 sal_Int32 len = aArguments.getLength();
752 if ((len < 1) || (len > 2)) {
753 throw css::lang::IllegalArgumentException(
754 ::rtl::OUString::createFromAscii("CURI::initialize: "
755 "must give 1 or 2 argument(s)"), *this, 2);
758 sal_Int16 arg(0);
759 ::rtl::OUString arg0;
760 ::rtl::OUString arg1;
761 if ((aArguments[0] >>= arg)) {
762 // integer argument: constant from rdf::URIs
763 if (len != 1) {
764 throw css::lang::IllegalArgumentException(
765 ::rtl::OUString::createFromAscii("CURI::initialize: "
766 "must give 1 int argument"), *this, 1);
768 initFromConstant(arg);
769 return;
771 if (!(aArguments[0] >>= arg0)) {
772 throw css::lang::IllegalArgumentException(
773 ::rtl::OUString::createFromAscii("CURI::initialize: "
774 "argument must be string or short"), *this, 0);
776 if (len > 1) {
777 if (!(aArguments[1] >>= arg1)) {
778 throw css::lang::IllegalArgumentException(
779 ::rtl::OUString::createFromAscii("CURI::initialize: "
780 "argument must be string"), *this, 1);
782 // just append the parameters and then split them again; seems simplest
783 arg0 = arg0 + arg1;
784 arg1 = ::rtl::OUString();
787 // split parameter
788 sal_Int32 idx;
789 if ( ((idx = arg0.indexOf ('#')) >= 0)
790 || ((idx = arg0.lastIndexOf('/')) >= 0)
791 || ((idx = arg0.lastIndexOf(':')) >= 0))
794 if (idx < arg0.getLength() - 1) {
795 arg1 = arg0.copy(idx+1);
796 arg0 = arg0.copy(0, idx+1);
798 } else {
799 throw css::lang::IllegalArgumentException(
800 ::rtl::OUString::createFromAscii("CURI::initialize: "
801 "argument not splittable: no separator [#/:]"), *this, 0);
804 //FIXME: what is legal?
805 if (arg0.getLength() > 0) {
806 m_Namespace = arg0;
807 } else {
808 throw css::lang::IllegalArgumentException(
809 ::rtl::OUString::createFromAscii("CURI::initialize: "
810 "argument is not valid namespace"), *this, 0);
812 //FIXME: what is legal?
813 if (true) {
814 m_LocalName = arg1;
815 } else {
816 throw css::lang::IllegalArgumentException(
817 ::rtl::OUString::createFromAscii("CURI::initialize: "
818 "argument is not valid local name"), *this, 1);
822 // ::com::sun::star::rdf::XNode:
823 ::rtl::OUString SAL_CALL CURI::getStringValue() throw (css::uno::RuntimeException)
825 return m_Namespace + m_LocalName;
828 // ::com::sun::star::rdf::XURI:
829 ::rtl::OUString SAL_CALL CURI::getNamespace() throw (css::uno::RuntimeException)
831 return m_Namespace;
834 ::rtl::OUString SAL_CALL CURI::getLocalName() throw (css::uno::RuntimeException)
836 return m_LocalName;
839 } // closing anonymous implementation namespace
843 // component helper namespace
844 namespace comp_CURI {
846 ::rtl::OUString SAL_CALL _getImplementationName() {
847 return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
848 "CURI"));
851 css::uno::Sequence< ::rtl::OUString > SAL_CALL _getSupportedServiceNames()
853 css::uno::Sequence< ::rtl::OUString > s(1);
854 s[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(
855 "com.sun.star.rdf.URI"));
856 return s;
859 css::uno::Reference< css::uno::XInterface > SAL_CALL _create(
860 const css::uno::Reference< css::uno::XComponentContext > & context)
861 SAL_THROW((css::uno::Exception))
863 return static_cast< ::cppu::OWeakObject * >(new CURI(context));
866 } // closing component helper namespace