32 #ifndef _MARKLOGIC_MARKLOGIC_H_
33 #define _MARKLOGIC_MARKLOGIC_H_
38 typedef __int32 int32_t;
39 typedef unsigned __int32 uint32_t;
40 typedef __int64 int64_t;
41 typedef unsigned __int64 uint64_t;
43 #define MLDLL __declspec(dllimport)
50 #define MARKLOGIC_API_VERSION 3
55 class CodePointStringImpl;
103 template<
class T,
typename PT>
113 operator PT&() {
return val; }
114 operator const PT&()
const {
return val; }
116 bool operator<(T o)
const {
return val < o.val; }
117 bool operator<=(T o)
const {
return val <= o.val; }
118 bool operator>(T o)
const {
return val > o.val; }
119 bool operator>=(T o)
const {
return val >= o.val; }
120 bool operator==(T o)
const {
return val == o.val; }
121 bool operator!=(T o)
const {
return val != o.val; }
123 T operator-(T o)
const {
return val - o.val; }
124 T operator+(T o)
const {
return val + o.val; }
125 T operator*(T o)
const {
return val * o.val; }
126 T operator/(T o)
const {
return val / o.val; }
128 T operator--(
int) {
return val--; }
129 T operator++(
int) {
return val++; }
130 T& operator--() { --val;
return (T&)*
this; }
131 T& operator++() { ++val;
return (T&)*
this; }
132 T& operator-=(T o) { val -= o.val;
return (T&)*
this; }
133 T& operator+=(T o) { val += o.val;
return (T&)*
this; }
134 T& operator*=(T o) { val *= o.val;
return (T&)*
this; }
135 T& operator/=(T o) { val /= o.val;
return (T&)*
this; }
138 template<
class T,
typename PT>
148 T operator-()
const {
return -this->val; }
149 T operator+()
const {
return +this->val; }
152 template<
class T,
typename PT>
162 T operator%(T o)
const {
return this->val % o.val; }
163 T& operator%=(T o) { this->val %= o.val;
return (T&)*
this; }
166 template<
class T,
typename PT>
176 T operator-()
const {
return -this->val; }
177 T operator+()
const {
return +this->val; }
182 typedef double DecimalType;
184 typedef long double DecimalType;
272 String(
const char* _str,
const char* _collation = 0);
277 operator bool()
const {
return str!=0; }
279 operator const char*()
const;
280 const char*
get()
const;
281 size_t length()
const;
282 const char* collation()
const;
284 bool operator<(
const String& o)
const;
285 bool operator<=(
const String& o)
const;
286 bool operator>(
const String& o)
const;
287 bool operator>=(
const String& o)
const;
288 bool operator==(
const String& o)
const;
289 bool operator!=(
const String& o)
const;
301 LangString(
const char* _str,
const char* _language = 0);
306 operator bool ()
const {
return str!=0; }
308 operator const char*()
const;
309 const char*
get()
const;
310 size_t length()
const;
311 const char* language()
const;
334 Point(
double _lat,
double _lng,
const char* _coordinateSystem =
"wgs84");
336 double latitude()
const;
337 double longitude()
const;
338 const char* coordinateSystem()
const;
340 bool operator<(
const Point& o)
const;
341 bool operator<=(
const Point& o)
const;
342 bool operator>(
const Point& o)
const;
343 bool operator>=(
const Point& o)
const;
344 bool operator==(
const Point& o)
const;
345 bool operator!=(
const Point& o)
const;
377 virtual void next() =0;
379 virtual bool done()
const =0;
383 virtual bool descending()
const =0;
385 virtual size_t width()
const =0;
391 virtual const char* collation(
size_t i)
const =0;
395 virtual const char* coordinateSystem(
size_t i)
const =0;
404 virtual uint64_t frequency()
const =0;
408 virtual bool null(
size_t i)
const =0;
422 virtual void value(
size_t i,
int&)
const =0;
423 virtual void value(
size_t i,
unsigned&)
const =0;
424 virtual void value(
size_t i, int64_t&)
const =0;
425 virtual void value(
size_t i, uint64_t&)
const =0;
426 virtual void value(
size_t i,
float&)
const =0;
427 virtual void value(
size_t i,
double&)
const =0;
428 virtual void value(
size_t i,
Decimal&)
const =0;
429 virtual void value(
size_t i,
DateTime&)
const =0;
430 virtual void value(
size_t i,
Date&)
const =0;
431 virtual void value(
size_t i,
Time&)
const =0;
432 virtual void value(
size_t i,
GYearMonth&)
const =0;
433 virtual void value(
size_t i,
GYear&)
const =0;
434 virtual void value(
size_t i,
GMonth&)
const =0;
435 virtual void value(
size_t i,
GDay&)
const =0;
438 virtual void value(
size_t i,
String&)
const =0;
439 virtual void value(
size_t i,
Point&)
const =0;
440 virtual void value(
size_t i,
LangString&)
const =0;
470 virtual void writeValue(
int) =0;
471 virtual void writeValue(
unsigned) =0;
472 virtual void writeValue(int64_t) =0;
473 virtual void writeValue(uint64_t) =0;
474 virtual void writeValue(
float) =0;
475 virtual void writeValue(
double) =0;
476 virtual void writeValue(
Decimal) =0;
477 virtual void writeValue(
DateTime) =0;
478 virtual void writeValue(
Date) =0;
479 virtual void writeValue(
Time) =0;
481 virtual void writeValue(
GYear) =0;
482 virtual void writeValue(
GMonth) =0;
483 virtual void writeValue(
GDay) =0;
486 virtual void writeValue(
const String&) =0;
487 virtual void writeValue(
Point) =0;
488 virtual void writeValue(
bool) =0;
489 virtual void writeValue(
const LangString&) =0;
517 virtual void startMap() =0;
521 virtual void writeMapKey(
const char*) =0;
523 virtual void endMap() =0;
543 virtual void encode(
const void*,
size_t) =0;
545 virtual void encode(
int) =0;
546 virtual void encode(
unsigned) =0;
547 virtual void encode(int64_t) =0;
548 virtual void encode(uint64_t) =0;
549 virtual void encode(
float) =0;
550 virtual void encode(
double) =0;
551 virtual void encode(
Decimal) =0;
553 virtual void encode(
Date) =0;
554 virtual void encode(
Time) =0;
556 virtual void encode(
GYear) =0;
557 virtual void encode(
GMonth) =0;
558 virtual void encode(
GDay) =0;
561 virtual void encode(
const String&) =0;
562 virtual void encode(
Point) =0;
563 virtual void encode(
bool) =0;
583 virtual void decode(
const void*&,
size_t&) =0;
584 virtual void decode(
void*,
size_t) =0;
586 virtual void decode(
int&) =0;
587 virtual void decode(
unsigned&) =0;
588 virtual void decode(int64_t&) =0;
589 virtual void decode(uint64_t&) =0;
590 virtual void decode(
float&) =0;
591 virtual void decode(
double&) =0;
592 virtual void decode(
Decimal&) =0;
594 virtual void decode(
Date&) =0;
595 virtual void decode(
Time&) =0;
597 virtual void decode(
GYear&) =0;
598 virtual void decode(
GMonth&) =0;
599 virtual void decode(
GDay&) =0;
602 virtual void decode(
String&) =0;
603 virtual void decode(
Point&) =0;
604 virtual void decode(
bool&) =0;
650 virtual LogLevel logLevel()
const =0;
652 virtual void log(LogLevel level,
const char* message) =0;
659 virtual void error(
const char* message) =0;
759 operator bool()
const {
return seq!=0; }
773 uint64_t frequency()
const;
778 void value(
int&)
const;
779 void value(
unsigned&)
const;
780 void value(int64_t&)
const;
781 void value(uint64_t&)
const;
782 void value(
float&)
const;
783 void value(
double&)
const;
786 void value(
Date&)
const;
787 void value(
Time&)
const;
789 void value(
GYear&)
const;
790 void value(
GMonth&)
const;
791 void value(
GDay&)
const;
794 void value(
String&)
const;
795 void value(
bool&)
const;
797 void value(
Point&)
const;
798 void value(
Map&)
const;
812 Map& operator=(
const Map&);
816 operator bool()
const {
return map!=0; }
819 Sequence get(
const char* key)
const;
878 virtual void close() =0;
1068 begin(_begin), end(_end), type(_type), pos(_pos) {}
1069 Token(
unsigned _begin,
unsigned _end, TokenType _type):
1070 begin(_begin), end(_end), type(_type), pos(UNSPECIFIED_POS) {}
1071 Token(): begin(0), end(0), type(SPACE), pos(UNSPECIFIED_POS) {}
1072 Token(
const Token& t):
1073 begin(t.begin), end(t.end), type(t.type), pos(t.pos) {}
1080 typedef unsigned CodePoint;
1092 operator bool()
const {
return cpstr!=0; };
1095 const CodePoint* data()
const;
1097 unsigned length()
const;
1100 void appendUTF8(
const char* utf8);
1102 void append(
const CodePoint* ptr,
unsigned siz);
1104 void push_back(CodePoint cp);
1108 void reserve(
size_t sz);
1111 CodePointStringImpl* cpstr;
1161 virtual void close() =0;
1167 virtual bool isStale()
const =0;
1178 virtual void initialize(
const char* lang,
1179 int argc,
const char** argv,
1192 virtual void reset(
const CodePoint* cp,
unsigned sz,
Reporter& r) =0;
1200 virtual void finish(
Reporter& r) =0;
1213 virtual const Token* token()
const =0;
1230 LexerUDF(
unsigned version = MARKLOGIC_API_VERSION);
1245 typedef LexerUDF*(*LexerFunction)();
1305 virtual void close() =0;
1311 virtual bool isStale()
const =0;
1322 virtual void initialize(
const char* lang,
1323 int argc,
const char** argv,
1342 virtual void start(
Reporter& r) =0;
1367 virtual bool delegate()
const =0;
1384 StemmerUDF(
unsigned version = MARKLOGIC_API_VERSION);
1443 void version(
unsigned pluginVersion = makeVersion(__DATE__,__TIME__),
1444 unsigned marklogicVersion = MARKLOGIC_API_VERSION);
1462 template<
class T>
void registerAggregate(
const char* name);
1482 virtual void registerAggregate(
const char* name, AggregateFunction f) =0;
1499 template<
class T>
void registerLexer(
const char* name);
1518 virtual void registerLexer(
const char* name, LexerFunction f) =0;
1535 template<
class T>
void registerStemmer(
const char* name);
1554 virtual void registerStemmer(
const char* name, StemmerFunction f) =0;
1562 static unsigned makeVersion(
const char*,
const char*);
1564 unsigned pluginVersion;
1569 constructAggregate()
Encapsulation of XQuery sequence item value type.
Definition: MarkLogic.h:670
xs:gYearMonth
Definition: MarkLogic.h:692
C++ representation of the XQuery type xs:decimal.
Definition: MarkLogic.h:187
void registerStemmer(const char *name)
Register a StemmerUDF implementation with MarkLogic Server.
Definition: MarkLogic.h:1604
Encapsulation of a User Defined Function for performing aggregate analysis across co-occurrences in r...
Definition: MarkLogic.h:856
xs:gDay
Definition: MarkLogic.h:695
xs:gMonth
Definition: MarkLogic.h:694
xs:unsignedLong
Definition: MarkLogic.h:685
C++ representation of the XQuery type xs:gYear.
Definition: MarkLogic.h:227
xs:date
Definition: MarkLogic.h:691
Order
Whether the index values are in ascending or descending order.
Definition: MarkLogic.h:97
Serialize values.
Definition: MarkLogic.h:540
Encapsulation of a User Defined Function for performing stemming of individual words.
Definition: MarkLogic.h:1297
C++ representation of the MarkLogic XQuery cts:point.
Definition: MarkLogic.h:325
Type
The type of the values in a range index.
Definition: MarkLogic.h:74
Definition: MarkLogic.h:139
C++ representation of the RDF type rdf:langString, encapsulating a string value with its language...
Definition: MarkLogic.h:297
C++ representation of the XQuery type xs:time.
Definition: MarkLogic.h:211
void registerLexer(const char *name)
Register a LexerUDF implementation with MarkLogic Server.
Definition: MarkLogic.h:1597
unsigned char PartOfSpeech
The part of speech of the token being returned. Part of speech is only relevant for word tokens...
Definition: MarkLogic.h:1049
A sequence of values produced by your AggregateUDF::finish implementation.
Definition: MarkLogic.h:464
xs:string
Definition: MarkLogic.h:91
xs:gYearMonth
Definition: MarkLogic.h:85
Encapsulation of a User Defined Function for performing tokenization of text runs.
Definition: MarkLogic.h:1153
Type
The types of item values that can occur in a Sequence.
Definition: MarkLogic.h:680
xs:int
Definition: MarkLogic.h:682
C++ representation of the XQuery type xs:dateTime.
Definition: MarkLogic.h:195
cts:point (MarkLogic XQuery dialect)
Definition: MarkLogic.h:711
xs:time
Definition: MarkLogic.h:690
xs:long
Definition: MarkLogic.h:684
void registerAggregate(const char *name)
Register an AggregateUDF implementation with MarkLogic Server.
Definition: MarkLogic.h:1590
C++ representation of the XQuery type xs:gYearMonth.
Definition: MarkLogic.h:219
xs:time
Definition: MarkLogic.h:83
xs:float
Definition: MarkLogic.h:79
LogLevel
Available log levels.
Definition: MarkLogic.h:630
A key-value map, equivalent to the MarkLogic XQuery type map:map.
Definition: MarkLogic.h:807
C++ representation of the MarkLogic token.
Definition: MarkLogic.h:1010
xs:float
Definition: MarkLogic.h:686
xs:yearMonthDuration
Definition: MarkLogic.h:89
Log messages and report errors to MarkLogic Server. You do not need to subclass this class...
Definition: MarkLogic.h:626
xs:date
Definition: MarkLogic.h:84
xs:unsignedInt
Definition: MarkLogic.h:683
Encapsulation of the configuration of a range index.
Definition: MarkLogic.h:63
xs:boolean
Definition: MarkLogic.h:700
xs:yearMonthDuration
Definition: MarkLogic.h:696
xs:int
Definition: MarkLogic.h:75
rdf:langString (SPARQL)
Definition: MarkLogic.h:715
xs:gMonth
Definition: MarkLogic.h:87
C++ representation of the XQuery type xs:dayTimeDuration.
Definition: MarkLogic.h:259
Definition: MarkLogic.h:104
C++ representation of the XQuery type xs:string, encapsulating a string value with its collation...
Definition: MarkLogic.h:268
xs:anyURI
Definition: MarkLogic.h:699
xs:anyURI
Definition: MarkLogic.h:92
xs:double
Definition: MarkLogic.h:687
The MarkLogic Server native plugin registry.
Definition: MarkLogic.h:1424
xs:decimal
Definition: MarkLogic.h:81
A sequence of Item values.
Definition: MarkLogic.h:750
Iterator over a sequence of N-way co-occurrences of range index values from a single stand...
Definition: MarkLogic.h:373
xs:dayTimeDuration
Definition: MarkLogic.h:90
xs:gYear
Definition: MarkLogic.h:693
C++ representation of the XQuery type xs:gMonth.
Definition: MarkLogic.h:235
Definition: MarkLogic.h:1082
map:map (MarkLogic XQuery dialect)
Definition: MarkLogic.h:712
unsigned char TokenType
The kind of token being returned.
Definition: MarkLogic.h:1022
xs:decimal
Definition: MarkLogic.h:688
xs:double
Definition: MarkLogic.h:80
C++ representation of the XQuery type xs:date.
Definition: MarkLogic.h:203
C++ representation of the XQuery type xs:gDay.
Definition: MarkLogic.h:243
xs:gYear
Definition: MarkLogic.h:86
xs:dateTime
Definition: MarkLogic.h:82
xs:gDay
Definition: MarkLogic.h:88
xs:unsignedInt
Definition: MarkLogic.h:76
xs:string
Definition: MarkLogic.h:698
xs:long
Definition: MarkLogic.h:77
Definition: MarkLogic.h:153
xs:dateTime
Definition: MarkLogic.h:689
C++ representation of the XQuery type xs:yearMonthDuration.
Definition: MarkLogic.h:251
xs:unsignedLong
Definition: MarkLogic.h:78
De-serialize values.
Definition: MarkLogic.h:580
Definition: MarkLogic.h:167
xs:dayTimeDuration
Definition: MarkLogic.h:697