blob: 30ae260a7fc3e43034ce6d5459b504411cbfde20 [file] [log] [blame]
Luiz Capitulino41836a92010-05-12 16:34:42 -03001/*
2 * QString Module
3 *
4 * Copyright (C) 2009 Red Hat Inc.
5 *
6 * Authors:
7 * Luiz Capitulino <lcapitulino@redhat.com>
8 *
9 * This work is licensed under the terms of the GNU LGPL, version 2.1 or later.
10 * See the COPYING.LIB file in the top-level directory.
11 */
12
Luiz Capitulino66f70482009-08-28 15:27:06 -030013#ifndef QSTRING_H
14#define QSTRING_H
15
Paolo Bonzini7b1b5d12012-12-17 18:19:43 +010016#include "qapi/qmp/qobject.h"
Luiz Capitulino66f70482009-08-28 15:27:06 -030017
Markus Armbruster9f5c7342018-02-01 12:18:34 +010018struct QString {
Markus Armbrusterc7c46212015-10-15 16:15:32 +020019 QObject base;
Luiz Capitulino66f70482009-08-28 15:27:06 -030020 char *string;
Anthony Liguorid30ec842009-11-11 10:49:51 -060021 size_t length;
22 size_t capacity;
Markus Armbruster9f5c7342018-02-01 12:18:34 +010023};
Luiz Capitulino66f70482009-08-28 15:27:06 -030024
Anthony Liguorid30ec842009-11-11 10:49:51 -060025QString *qstring_new(void);
Luiz Capitulino66f70482009-08-28 15:27:06 -030026QString *qstring_from_str(const char *str);
Luiz Capitulino4b5c5762009-11-18 23:05:27 -020027QString *qstring_from_substr(const char *str, int start, int end);
Luiz Capitulino54d49ac2013-03-25 13:46:37 -040028size_t qstring_get_length(const QString *qstring);
Luiz Capitulino66f70482009-08-28 15:27:06 -030029const char *qstring_get_str(const QString *qstring);
Peter Xu77593202018-03-09 16:59:45 +080030const char *qstring_get_try_str(const QString *qstring);
Peter Xub26ae1c2018-03-09 16:59:46 +080031const char *qobject_get_try_str(const QObject *qstring);
Luiz Capitulino764c1ca2009-11-18 23:05:26 -020032void qstring_append_int(QString *qstring, int64_t value);
Anthony Liguorid30ec842009-11-11 10:49:51 -060033void qstring_append(QString *qstring, const char *str);
Luiz Capitulino6fe95652009-11-18 23:05:25 -020034void qstring_append_chr(QString *qstring, int c);
Max Reitzb38dd672017-11-14 19:01:25 +010035bool qstring_is_equal(const QObject *x, const QObject *y);
Eric Blake55e18192015-12-01 22:20:45 -070036void qstring_destroy_obj(QObject *obj);
Luiz Capitulino66f70482009-08-28 15:27:06 -030037
38#endif /* QSTRING_H */