Stroika Library 3.0d25
 
Loading...
Searching...
No Matches
DataExchange/XML/Schema.inl
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2026. All rights reserved
3 */
5
6namespace Stroika::Foundation::DataExchange::XML::Schema {
7
8 /*
9 ********************************************************************************
10 ************************************* Schema::Ptr ******************************
11 ********************************************************************************
12 */
13 inline Ptr::Ptr (nullptr_t)
14 {
15 }
16 inline Ptr::Ptr (shared_ptr<IRep> s)
17 : fRep_{s}
18 {
19 }
20 inline optional<URI> Ptr::GetTargetNamespace () const
21 {
22 return fRep_->GetTargetNamespace ();
23 }
24 inline shared_ptr<IRep> Ptr::GetRep () const
25 {
26 return fRep_;
27 }
28#if qStroika_Foundation_DataExchange_XML_SupportDOM
29 template <>
30 XML::DOM::Document::Ptr Ptr::As ();
31#endif
32 template <typename AS_T>
33 AS_T Ptr::As ()
34#if !qCompilerAndStdLib_RequiresNotMatchInlineOutOfLineForTemplateClassBeingDefined_Buggy
35 requires (same_as<AS_T, String>
36#if qStroika_Foundation_DataExchange_XML_SupportDOM
37 or same_as<AS_T, XML::DOM::Document::Ptr>
38#endif
39 or same_as<AS_T, Memory::BLOB>)
40#endif
41 {
42 if constexpr (same_as<AS_T, String>) {
43 return Streams::BinaryToText::Reader::New (fRep_->GetData ()).ReadAll ();
44 }
45 else if constexpr (same_as<AS_T, Memory::BLOB>) {
46 return fRep_->GetData ();
47 }
48 }
49 // defined in Schema.cpp, where ISchemaProvider is complete: its call to New, not dependent on AS_T, is resolved where it
50 // is defined - and here, before IProvider.h defines ISchemaProvider, considering New (stream, ...) would test whether
51 // an incomplete ISchemaProvider converts to an InputStream::Ptr (g++'s -Wsfinae-incomplete)
52 template <>
53 XML::Schema::Ptr Ptr::As (const Providers::ISchemaProvider& p);
54 template <>
55 XML::DOM::Document::Ptr Ptr::As (const Providers::IDOMProvider& p);
56
57}
Document::Ptr is create with Document::New, and is a smart pointer to a DOM document object.
Definition DOM.h:721