-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcallargument.cpp
70 lines (55 loc) · 1.6 KB
/
callargument.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#include "marshallruby.h"
#include "callargument.h"
const QVector<QVariant> &CallArgument::getArgs2()
{
if (m_argc - m_offset < m_vargv2.count()) {
m_vargv2 = MarshallRuby::ARGV2Variant(m_argc, m_argv, m_offset);
}
return m_vargv2;
}
const QVariant &CallArgument::getArg2(int idx)
{
if (m_argc - m_offset < m_vargv.count()) {
m_vargv2 = MarshallRuby::ARGV2Variant(m_argc, m_argv, m_offset);
}
return m_vargv2[idx];
}
const QVector<QSharedPointer<MetaTypeVariant> > &CallArgument::getArgs()
{
qDebug()<<"callarg:"<<m_argc<<m_offset<<m_vargv.count();
if (m_argc - m_offset >= m_vargv.count()) {
m_vargv = MarshallRuby::ARGV2MTVariant(m_argc, m_argv, m_offset);
qDebug()<<"callarg:"<<m_vargv;
}
return m_vargv;
}
const QSharedPointer<MetaTypeVariant> CallArgument::getArg(int idx)
{
if (m_argc - m_offset < m_vargv.count()) {
m_vargv = MarshallRuby::ARGV2MTVariant(m_argc, m_argv, m_offset);
}
return m_vargv[idx];
}
//////////////
MetaTypeVariant::MetaTypeVariant(int type, const void *paddr)
{
mtype = type;
if (paddr) {
maddr = QMetaType::create(QMetaType::QVariant, paddr);
}
}
MetaTypeVariant::MetaTypeVariant(int type, QVariant& vaddr)
{
mtype = type;
maddr = QMetaType::create(QMetaType::QVariant, &vaddr);
}
QVariant MetaTypeVariant::toVariant() const
{
QByteArray data;
QDataStream stm(&data, QIODevice::WriteOnly);
bool bret = QMetaType::save(stm, QMetaType::QVariant, maddr);
QDataStream rdstm(&data, QIODevice::ReadOnly);
QVariant rv;
rdstm >> rv;
return (rv);
}