1 // This file generated by libqtelegram-code-generator.
2 // You can download it from: https://github.com/Aseman-Land/libqtelegram-code-generator
3 // DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
4 
5 #include "inputphoto.h"
6 #include "core/inboundpkt.h"
7 #include "core/outboundpkt.h"
8 #include "../coretypes.h"
9 
InputPhoto(InputPhotoType classType,InboundPkt * in)10 InputPhoto::InputPhoto(InputPhotoType classType, InboundPkt *in) :
11     m_accessHash(0),
12     m_id(0),
13     m_classType(classType)
14 {
15     if(in) fetch(in);
16 }
17 
InputPhoto(InboundPkt * in)18 InputPhoto::InputPhoto(InboundPkt *in) :
19     m_accessHash(0),
20     m_id(0),
21     m_classType(typeInputPhotoEmpty)
22 {
23     fetch(in);
24 }
25 
~InputPhoto()26 InputPhoto::~InputPhoto() {
27 }
28 
setAccessHash(qint64 accessHash)29 void InputPhoto::setAccessHash(qint64 accessHash) {
30     m_accessHash = accessHash;
31 }
32 
accessHash() const33 qint64 InputPhoto::accessHash() const {
34     return m_accessHash;
35 }
36 
setId(qint64 id)37 void InputPhoto::setId(qint64 id) {
38     m_id = id;
39 }
40 
id() const41 qint64 InputPhoto::id() const {
42     return m_id;
43 }
44 
operator ==(const InputPhoto & b)45 bool InputPhoto::operator ==(const InputPhoto &b) {
46     return m_accessHash == b.m_accessHash &&
47            m_id == b.m_id;
48 }
49 
setClassType(InputPhoto::InputPhotoType classType)50 void InputPhoto::setClassType(InputPhoto::InputPhotoType classType) {
51     m_classType = classType;
52 }
53 
classType() const54 InputPhoto::InputPhotoType InputPhoto::classType() const {
55     return m_classType;
56 }
57 
fetch(InboundPkt * in)58 bool InputPhoto::fetch(InboundPkt *in) {
59     LQTG_FETCH_LOG;
60     int x = in->fetchInt();
61     switch(x) {
62     case typeInputPhotoEmpty: {
63         m_classType = static_cast<InputPhotoType>(x);
64         return true;
65     }
66         break;
67 
68     case typeInputPhoto: {
69         m_id = in->fetchLong();
70         m_accessHash = in->fetchLong();
71         m_classType = static_cast<InputPhotoType>(x);
72         return true;
73     }
74         break;
75 
76     default:
77         LQTG_FETCH_ASSERT;
78         return false;
79     }
80 }
81 
push(OutboundPkt * out) const82 bool InputPhoto::push(OutboundPkt *out) const {
83     out->appendInt(m_classType);
84     switch(m_classType) {
85     case typeInputPhotoEmpty: {
86         return true;
87     }
88         break;
89 
90     case typeInputPhoto: {
91         out->appendLong(m_id);
92         out->appendLong(m_accessHash);
93         return true;
94     }
95         break;
96 
97     default:
98         return false;
99     }
100 }
101 
102