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 "chatphoto.h"
6 #include "core/inboundpkt.h"
7 #include "core/outboundpkt.h"
8 #include "../coretypes.h"
9 
ChatPhoto(ChatPhotoType classType,InboundPkt * in)10 ChatPhoto::ChatPhoto(ChatPhotoType classType, InboundPkt *in) :
11     m_classType(classType)
12 {
13     if(in) fetch(in);
14 }
15 
ChatPhoto(InboundPkt * in)16 ChatPhoto::ChatPhoto(InboundPkt *in) :
17     m_classType(typeChatPhotoEmpty)
18 {
19     fetch(in);
20 }
21 
~ChatPhoto()22 ChatPhoto::~ChatPhoto() {
23 }
24 
setPhotoBig(const FileLocation & photoBig)25 void ChatPhoto::setPhotoBig(const FileLocation &photoBig) {
26     m_photoBig = photoBig;
27 }
28 
photoBig() const29 FileLocation ChatPhoto::photoBig() const {
30     return m_photoBig;
31 }
32 
setPhotoSmall(const FileLocation & photoSmall)33 void ChatPhoto::setPhotoSmall(const FileLocation &photoSmall) {
34     m_photoSmall = photoSmall;
35 }
36 
photoSmall() const37 FileLocation ChatPhoto::photoSmall() const {
38     return m_photoSmall;
39 }
40 
operator ==(const ChatPhoto & b)41 bool ChatPhoto::operator ==(const ChatPhoto &b) {
42     return m_photoBig == b.m_photoBig &&
43            m_photoSmall == b.m_photoSmall;
44 }
45 
setClassType(ChatPhoto::ChatPhotoType classType)46 void ChatPhoto::setClassType(ChatPhoto::ChatPhotoType classType) {
47     m_classType = classType;
48 }
49 
classType() const50 ChatPhoto::ChatPhotoType ChatPhoto::classType() const {
51     return m_classType;
52 }
53 
fetch(InboundPkt * in)54 bool ChatPhoto::fetch(InboundPkt *in) {
55     LQTG_FETCH_LOG;
56     int x = in->fetchInt();
57     switch(x) {
58     case typeChatPhotoEmpty: {
59         m_classType = static_cast<ChatPhotoType>(x);
60         return true;
61     }
62         break;
63 
64     case typeChatPhoto: {
65         m_photoSmall.fetch(in);
66         m_photoBig.fetch(in);
67         m_classType = static_cast<ChatPhotoType>(x);
68         return true;
69     }
70         break;
71 
72     default:
73         LQTG_FETCH_ASSERT;
74         return false;
75     }
76 }
77 
push(OutboundPkt * out) const78 bool ChatPhoto::push(OutboundPkt *out) const {
79     out->appendInt(m_classType);
80     switch(m_classType) {
81     case typeChatPhotoEmpty: {
82         return true;
83     }
84         break;
85 
86     case typeChatPhoto: {
87         m_photoSmall.push(out);
88         m_photoBig.push(out);
89         return true;
90     }
91         break;
92 
93     default:
94         return false;
95     }
96 }
97 
98