qstring.h 964 字节
Newer Older
L
Luiz Capitulino 已提交
1 2 3 4 5 6 7 8 9 10 11 12
/*
 * QString Module
 *
 * Copyright (C) 2009 Red Hat Inc.
 *
 * Authors:
 *  Luiz Capitulino <lcapitulino@redhat.com>
 *
 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
 * See the COPYING.LIB file in the top-level directory.
 */

L
Luiz Capitulino 已提交
13 14 15
#ifndef QSTRING_H
#define QSTRING_H

16
#include "qapi/qmp/qobject.h"
L
Luiz Capitulino 已提交
17 18

typedef struct QString {
M
Markus Armbruster 已提交
19
    QObject base;
L
Luiz Capitulino 已提交
20
    char *string;
A
Anthony Liguori 已提交
21 22
    size_t length;
    size_t capacity;
L
Luiz Capitulino 已提交
23 24
} QString;

A
Anthony Liguori 已提交
25
QString *qstring_new(void);
L
Luiz Capitulino 已提交
26
QString *qstring_from_str(const char *str);
27
QString *qstring_from_substr(const char *str, int start, int end);
28
size_t qstring_get_length(const QString *qstring);
L
Luiz Capitulino 已提交
29
const char *qstring_get_str(const QString *qstring);
30
void qstring_append_int(QString *qstring, int64_t value);
A
Anthony Liguori 已提交
31
void qstring_append(QString *qstring, const char *str);
32
void qstring_append_chr(QString *qstring, int c);
L
Luiz Capitulino 已提交
33
QString *qobject_to_qstring(const QObject *obj);
E
Eric Blake 已提交
34
void qstring_destroy_obj(QObject *obj);
L
Luiz Capitulino 已提交
35 36

#endif /* QSTRING_H */