GLMapStyleParser

Objective-C


@interface GLMapStyleParser : NSObject

Swift

class GLMapStyleParser : NSObject

GLMapStyleParser is a class to parse style and analyze the result of parsing.

  • Loads resource from path.

    Declaration

    Objective-C

    + (GLMapResource)loadResourceFromPath:(nonnull NSString *)path
                                     name:(nonnull NSString *)name;

    Swift

    class func loadResource(fromPath path: String, name: String) -> GLMapResource

    Parameters

    path

    Directory where the resource will be loaded.

    name

    Name of the resource.

  • Initializes the parser without resources.

    Declaration

    Objective-C

    - (nonnull instancetype)init;

    Swift

    init()
  • Initializes the parser with resources stored in the bundle.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithBundle:(nonnull NSBundle *)bundle;

    Swift

    init(bundle: Bundle)

    Parameters

    bundle

    Bundle object with Style.mapcss and images.

  • Initializes the parser with resources stored in paths. First, it tries to find the resource in the first path, then in the second, and so on.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithPaths:(nonnull NSArray<NSString *> *)paths;

    Swift

    init(paths: [String])

    Parameters

    paths

    Paths where the style will search for resources.

  • Initializes the parser with a resource block.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithBlock:(nonnull GLMapResourceBlock)resourceBlock;

    Swift

    init(block resourceBlock: @escaping GLMapResourceBlock)

    Parameters

    resourceBlock

    Block that will provide resources.

  • Mask to clamp zoom levels.

    Declaration

    Objective-C

    @property uint32_t clampZoomMask;

    Swift

    var clampZoomMask: UInt32 { get set }
  • All options for @if tests found while parsing.

    Declaration

    Objective-C

    @property (readonly) NSSet<NSString *> *_Nullable allOptions;

    Swift

    var allOptions: Set<String>? { get }
  • Error that occurred while parsing.

    Declaration

    Objective-C

    @property (readonly) NSError *_Nullable error;

    Swift

    var error: Error? { get }
  • Sets global options. Will be available in all instances of the parser.

    Declaration

    Objective-C

    + (void)setGlobalOptions:
        (nonnull NSDictionary<NSString *, NSString *> *)options;

    Swift

    class func setGlobalOptions(_ options: [String : String])

    Parameters

    options

    Values for options.

  • Sets style options.

    Declaration

    Objective-C

    - (void)setOptions:(nonnull NSDictionary<NSString *, NSString *> *)options
          defaultValue:(BOOL)defaultValue;

    Swift

    func setOptions(_ options: [String : String], defaultValue: Bool)

    Parameters

    options

    Values for options.

    defaultValue

    The value used for not set options.

  • Parses the next chunk of style.

    Declaration

    Objective-C

    - (BOOL)parseNextBuffer:(nonnull NSData *)data;

    Swift

    func parseNextBuffer(_ data: Data) -> Bool

    Parameters

    data

    Chunk of style to parse.

  • Parses the next chunk of style.

    Declaration

    Objective-C

    - (BOOL)parseNextString:(nonnull NSString *)string;

    Swift

    func parseNextString(_ string: String) -> Bool

    Parameters

    string

    Chunk of style to parse.

  • Finishes parsing. @returns Returns the result of parsing. If an error occurred, the returned value is nil. Check the error for details.

    Declaration

    Objective-C

    - (GLMapVectorCascadeStyle *_Nullable)finish;

    Swift

    func finish() -> GLMapVectorCascadeStyle?
  • Appends data from “Style.mapcss” in resources and finishes parsing. @returns Returns the result of parsing. If an error occurred, the returned value is nil. Check the error for details.

    Declaration

    Objective-C

    - (GLMapVectorCascadeStyle *_Nullable)parseFromResources;

    Swift

    func parseFromResources() -> GLMapVectorCascadeStyle?