Sha256: d5f25a7d63d004bd3abe86255b2877f5c6415939338202c32fc78e218c9554fc

Contents?: true

Size: 1.61 KB

Versions: 23

Compression:

Stored size: 1.61 KB

Contents

/*
 * Copyright (C) the libgit2 contributors. All rights reserved.
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */
#ifndef INCLUDE_parse_h__
#define INCLUDE_parse_h__

#include "common.h"

typedef struct {
	/* Original content buffer */
	const char *content;
	size_t content_len;

	/* The remaining (unparsed) buffer */
	const char *remain;
	size_t remain_len;

	const char *line;
	size_t line_len;
	size_t line_num;
} git_parse_ctx;

#define GIT_PARSE_CTX_INIT { 0 }

int git_parse_ctx_init(git_parse_ctx *ctx, const char *content, size_t content_len);
void git_parse_ctx_clear(git_parse_ctx *ctx);

#define git_parse_ctx_contains_s(ctx, str) \
	git_parse_ctx_contains(ctx, str, sizeof(str) - 1)

GIT_INLINE(bool) git_parse_ctx_contains(
	git_parse_ctx *ctx, const char *str, size_t len)
{
	return (ctx->line_len >= len && memcmp(ctx->line, str, len) == 0);
}

void git_parse_advance_line(git_parse_ctx *ctx);
void git_parse_advance_chars(git_parse_ctx *ctx, size_t char_cnt);
int git_parse_advance_expected(
	git_parse_ctx *ctx,
	const char *expected,
	size_t expected_len);

#define git_parse_advance_expected_str(ctx, str) \
	git_parse_advance_expected(ctx, str, strlen(str))

int git_parse_advance_ws(git_parse_ctx *ctx);
int git_parse_advance_nl(git_parse_ctx *ctx);
int git_parse_advance_digit(int64_t *out, git_parse_ctx *ctx, int base);
int git_parse_advance_oid(git_oid *out, git_parse_ctx *ctx);

enum GIT_PARSE_PEEK_FLAGS {
	GIT_PARSE_PEEK_SKIP_WHITESPACE = (1 << 0)
};

int git_parse_peek(char *out, git_parse_ctx *ctx, int flags);

#endif

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
rugged-1.6.5 vendor/libgit2/src/libgit2/parse.h
rugged-1.6.3 vendor/libgit2/src/libgit2/parse.h
rugged-1.6.2 vendor/libgit2/src/libgit2/parse.h
rugged-1.5.1 vendor/libgit2/src/libgit2/parse.h
rugged-1.4.5 vendor/libgit2/src/parse.h
rugged-1.5.0.1 vendor/libgit2/src/libgit2/parse.h
rugged-1.5.0 vendor/libgit2/src/libgit2/parse.h
rugged-1.3.2.3 vendor/libgit2/src/parse.h
rugged-1.4.4 vendor/libgit2/src/parse.h
rugged-1.3.2.1 vendor/libgit2/src/parse.h
rugged-1.4.3 vendor/libgit2/src/parse.h
rugged-1.3.2 vendor/libgit2/src/parse.h
rugged-1.4.2 vendor/libgit2/src/parse.h
rugged-1.3.1 vendor/libgit2/src/parse.h
rugged-1.3.0 vendor/libgit2/src/parse.h
rugged-1.2.0 vendor/libgit2/src/parse.h
rugged-1.1.1 vendor/libgit2/src/parse.h
rugged-1.1.0 vendor/libgit2/src/parse.h
rugged-1.0.1 vendor/libgit2/src/parse.h
rugged-1.0.0 vendor/libgit2/src/parse.h