PBDataReader.h
 1  /*
 2   This file is part of Darling.
 3  
 4   Copyright (C) 2020 Lubos Dolezel
 5  
 6   Darling is free software: you can redistribute it and/or modify
 7   it under the terms of the GNU General Public License as published by
 8   the Free Software Foundation, either version 3 of the License, or
 9   (at your option) any later version.
10  
11   Darling is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15  
16   You should have received a copy of the GNU General Public License
17   along with Darling.  If not, see <http://www.gnu.org/licenses/>.
18  */
19  
20  #include <Foundation/Foundation.h>
21  
22  // not sure what this type is
23  typedef int PBDataReaderMark;
24  
25  @interface PBDataReader : NSObject
26  
27  @end
28  
29  // seems to be either a macro or an inline function
30  // (probably the latter)
31  static inline BOOL PBReaderHasMoreData(PBDataReader* reader) {
32  	return FALSE; // stubbed
33  };
34  
35  static inline void PBReaderReadTag32AndType(PBDataReader* reader, uint32_t* tag, uint8_t* type) {
36  	return;
37  };
38  
39  static inline BOOL PBReaderHasError(PBDataReader* reader) {
40  	return FALSE;
41  };
42  
43  static inline BOOL PBReaderReadBOOL(PBDataReader* reader) {
44  	return FALSE;
45  };
46  
47  static inline uint32_t PBReaderReadUint32(PBDataReader *reader) {
48  	return 0;
49  }
50  
51  static inline int32_t PBReaderReadInt32(PBDataReader* reader) {
52  	return 0;
53  }
54  
55  static inline uint64_t PBReaderReadUint64(PBDataReader* reader) {
56  	return 0;
57  };
58  
59  NSString* PBReaderReadString(PBDataReader* reader);
60  NSData* PBReaderReadData(PBDataReader* reader);
61  BOOL PBReaderPlaceMark(PBDataReader* reader, PBDataReaderMark* mark);
62  void PBReaderRecallMark(PBDataReader* reader, PBDataReaderMark* mark);
63  BOOL PBReaderSkipValueWithTag(PBDataReader* reader, uint32_t tag, uint8_t type);
64  
65  // guesses
66  uint16_t PBReaderReadBigEndianFixed16(PBDataReader* reader);
67  uint32_t PBReaderReadBigEndianFixed32(PBDataReader* reader);
68  uint64_t PBReaderReadBigEndianFixed64(PBDataReader* reader);
69  void* PBReaderReadVarIntBuf(PBDataReader* reader);