A ContentQuery allows you to construct a complex statement that selects specific content by type, tag, or id.
More...
|
| ContentQuery (ContentQuery other) |
| The copy-constructor for a ContentQuery More...
|
|
virtual bool | Accept (IContentObject content) |
| Check if the given IContentObject meets the tag, type, and id constraints. Tags are AND based, so the content must have ALL tags in the TagConstraints field. Types are OR based, so the content type only needs to be one of the types specified in the TypeConstraints field. This check allows subtypes of types in the TypeConstraints to be accepted. The id constraint is a substring match, so as long as the content's id contains the DefaultQuery.IdContainsConstraint , the id constraint passes. More...
|
|
bool | AcceptTag (IContentObject content) |
| Check if the given IContentObject meets the tag constraint. Tags are AND based, so the content must have ALL tags in the TagConstraints field. More...
|
|
bool | AcceptTags (HashSet< string > tags) |
| Check if the given set of tags would meet the tag constraint. Tags are AND based, so the given set of tags must have ALL tags in the TagConstraints field. More...
|
|
bool | AcceptType< TContent > (bool allowInherit=true) |
| Check if the given generic content type passes the type constraint. Types are OR based, so the content type only needs to be one of the types specified in the TypeConstraints field. More...
|
|
bool | AcceptType (Type type, bool allowInherit=true) |
| Check if the given runtime type passes the type constraint Types are OR based, so the content type only needs to be one of the types specified in the TypeConstraints field. More...
|
|
bool | AcceptIdContains (IContentObject content) |
| Check if the given IContentObject content passes the id constraint. The id constraint is a substring match, so as long as the content's id contains the DefaultQuery.IdContainsConstraint , the id constraint passes. More...
|
|
bool | EqualsContentQuery (ContentQuery other) |
| Check if this ContentQuery would select the same content as the given ContentQuery. The equality match is based on set equality, not order equality. More...
|
|
override bool | Equals (object obj) |
| The equality operator. See EqualsContentQuery(ContentQuery) More...
|
|
override int | GetHashCode () |
| Get the hashcode for the ContentQuery More...
|
|
string | ToString (string existing) |
| Convert the ContentQuery back into a string format. This method will guarantee that the output string would serialize back into a ContentQuery that would be equal when checked with the EqualsContentQuery method. More...
|
|
override string | ToString () |
| Convert the ContentQuery back into a string format. This method will guarantee that the output string would serialize back into a ContentQuery that would be equal when checked with the EqualsContentQuery method. More...
|
|
bool | AcceptIdContains (string id) |
|
|
HashSet< Type > | TypeConstraints |
| Type constraints instruct the ContentQuery to select content that matches the given types. In string form, this can be represented as "t:items", or "t:announcements". Multiple type constraints are treated as an OR operation. As a string, "t:items announcements" will select all items and announcements.
|
|
HashSet< string > | TagConstraints |
| Tag constraints instruct the ContentQuery to select content that contain the given tags. In string form, this can be represented as "tag:a", or "tag:a b". Multiple tag constraints are treated as an AND operation. As a string, "tag:a b" will only match content that have both the "a" tag, and the "b" tag.
|
|
string | IdContainsConstraint |
|
|
static void | ApplyTypeParse (string raw, ContentQuery query) |
|
static void | ApplyTagParse (string raw, ContentQuery query) |
|
static bool | SerializeTagRule (ContentQuery query, out string str) |
|
static bool | SerializeTypeRule (ContentQuery query, out string str) |
|
static bool | SerializeIdRule (DefaultQuery query, out string str) |
|
A ContentQuery allows you to construct a complex statement that selects specific content by type, tag, or id.
◆ ContentQuery()
Beamable.Common.Content.ContentQuery.ContentQuery |
( |
ContentQuery |
other | ) |
|
|
inline |
The copy-constructor for a ContentQuery
- Parameters
-
other | A ContentQuery to clone. The given instance will not be mutated. |
◆ Accept()
virtual bool Beamable.Common.Content.ContentQuery.Accept |
( |
IContentObject |
content | ) |
|
|
inlinevirtual |
Check if the given IContentObject meets the tag, type, and id constraints. Tags are AND based, so the content must have ALL tags in the TagConstraints field. Types are OR based, so the content type only needs to be one of the types specified in the TypeConstraints field. This check allows subtypes of types in the TypeConstraints to be accepted. The id constraint is a substring match, so as long as the content's id contains the DefaultQuery.IdContainsConstraint , the id constraint passes.
- Parameters
-
- Returns
- true if the content passes the constraints, false otherwise.
◆ AcceptIdContains()
bool Beamable.Common.Content.ContentQuery.AcceptIdContains |
( |
IContentObject |
content | ) |
|
|
inline |
Check if the given IContentObject content passes the id constraint. The id constraint is a substring match, so as long as the content's id contains the DefaultQuery.IdContainsConstraint , the id constraint passes.
- Parameters
-
- Returns
- rue if the content passes the id constraint, false otherwise.
◆ AcceptTag()
bool Beamable.Common.Content.ContentQuery.AcceptTag |
( |
IContentObject |
content | ) |
|
|
inline |
Check if the given IContentObject meets the tag constraint. Tags are AND based, so the content must have ALL tags in the TagConstraints field.
- Parameters
-
- Returns
- true if the content passes the tag constraint, false otherse.
◆ AcceptTags()
bool Beamable.Common.Content.ContentQuery.AcceptTags |
( |
HashSet< string > |
tags | ) |
|
|
inline |
Check if the given set of tags would meet the tag constraint. Tags are AND based, so the given set of tags must have ALL tags in the TagConstraints field.
- Parameters
-
- Returns
- true if the set of tags passes the tag constraint, false otherwise
◆ AcceptType()
bool Beamable.Common.Content.ContentQuery.AcceptType |
( |
Type |
type, |
|
|
bool |
allowInherit = true |
|
) |
| |
|
inline |
Check if the given runtime type passes the type constraint Types are OR based, so the content type only needs to be one of the types specified in the TypeConstraints field.
- Parameters
-
type | A runtime type that should derive from IContentObject |
allowInherit | By default, a subclass of a type listed in the TypeConstraints set is allowed to pass the constraint. Disable this field to disable that behaviour, so that only exact type matches are accepted. |
- Returns
- true if the type passes the type constraint, false otherwise.
◆ AcceptType< TContent >()
Check if the given generic content type passes the type constraint. Types are OR based, so the content type only needs to be one of the types specified in the TypeConstraints field.
- Parameters
-
allowInherit | By default, a subclass of a type listed in the TypeConstraints set is allowed to pass the constraint. Disable this field to disable that behaviour, so that only exact type matches are accepted. |
- Template Parameters
-
- Returns
- true if the type passes the type constraint, false otherwise.
- Type Constraints
-
TContent | : | IContentObject | |
TContent | : | new() | |
◆ Equals()
override bool Beamable.Common.Content.ContentQuery.Equals |
( |
object |
obj | ) |
|
|
inline |
◆ EqualsContentQuery()
bool Beamable.Common.Content.ContentQuery.EqualsContentQuery |
( |
ContentQuery |
other | ) |
|
|
inline |
Check if this ContentQuery would select the same content as the given ContentQuery. The equality match is based on set equality, not order equality.
- Parameters
-
- Returns
- true if the two queries select the same content, false otherwise.
◆ GetHashCode()
override int Beamable.Common.Content.ContentQuery.GetHashCode |
( |
| ) |
|
|
inline |
◆ Parse()
static ContentQuery Beamable.Common.Content.ContentQuery.Parse |
( |
string |
text | ) |
|
|
inlinestatic |
Produce a ContentQuery from its string format. The string can contain many clauses for the allowed constraints.
To specify type constraints, add a "t:" clause, like "t:items". You can select multiple types by specifying multiple types as space separated in the string, like "t:items announcements". The resulting types will fill out the TypeConstraints field.
To specify tag constraints, add a "tag:" clause, like "tag:a". You can select content that have many required tags by adding more tags as space separated in the string, like "t:a b". The resulting tags will fill out the TagConstraints field.
To specify an id constraint, add a "id:" clause, or specify the id as a standalone string. Both "id:items.hat" and "items.hat" produce the same output. The id will fill the DefaultQuery.IdContainsConstraint field. Ids are substring matched, so if you search for an id of "ha", it will match "items.hat".
- Parameters
-
text | The string version of the query. |
- Returns
- A ContentQuery
◆ ToString() [1/2]
override string Beamable.Common.Content.ContentQuery.ToString |
( |
| ) |
|
|
inline |
◆ ToString() [2/2]
string Beamable.Common.Content.ContentQuery.ToString |
( |
string |
existing | ) |
|
|
inline |
Convert the ContentQuery back into a string format. This method will guarantee that the output string would serialize back into a ContentQuery that would be equal when checked with the EqualsContentQuery method.
- Parameters
-
existing | A string that used to represent the ContentQuery. The output string will try to conform to this format as close as possible to reduce string jitter. |
- Returns
- The string form of the ContentQuery
◆ StandardRules
readonly Dictionary<string, DefaultQueryParser.ApplyParseRule<ContentQuery> > Beamable.Common.Content.ContentQuery.StandardRules |
|
staticprotected |
Initial value:= new Dictionary<string, DefaultQueryParser.ApplyParseRule<ContentQuery>>
{
{"t", ApplyTypeParse},
{"id", DefaultQueryParser.ApplyIdParse},
{"tag", ApplyTagParse},
}
◆ StandardSerializeRules
readonly List<DefaultQueryParser.SerializeRule<ContentQuery> > Beamable.Common.Content.ContentQuery.StandardSerializeRules |
|
staticprotected |
Initial value:= new List<DefaultQueryParser.SerializeRule<ContentQuery>>
{
SerializeTagRule, SerializeTypeRule, SerializeIdRule
}
The documentation for this class was generated from the following file:
- com.beamable/Common/Runtime/Content/ContentQuery.cs