File: DataTypeCode.cpp

package info (click to toggle)
android-file-transfer 4.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,496 kB
  • sloc: cpp: 12,909; python: 140; lex: 47; xml: 26; sh: 13; makefile: 6
file content (31 lines) | stat: -rw-r--r-- 593 bytes parent folder | download | duplicates (3)
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
#include <mtp/ptp/DataTypeCode.h>
#include <mtp/log.h>

namespace mtp
{
	std::string ToString(DataTypeCode type)
	{
		switch(type)
		{
#			define ENUM_VALUE(NAME, VALUE) ENUM_VALUE_TO_STRING(DataTypeCode, NAME, VALUE)
#			include <mtp/ptp/DataTypeCode.values.h>
			ENUM_VALUE_TO_STRING_DEFAULT(DataTypeCode, type, 4);
		}
	}
	bool IsArray(DataTypeCode type)
	{
		switch(type)
		{
#			define CASE(BITS) case DataTypeCode::ArrayInt##BITS :  case DataTypeCode::ArrayUint##BITS :
			CASE(8)
			CASE(16)
			CASE(32)
			CASE(64)
			CASE(128)
				return true;
			default:
				return false;
		}
	}

}