summaryrefslogtreecommitdiffstats
path: root/src/common/common/purl_base.h
blob: 783daf0ce0a0d9bf48abbbea9c52093c2af6a443 (plain)
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
70
71
72
73
74
75
76
77
78
79
/***************************************************************************
 *   Copyright (C) 2005-2006 Nicolas Hadacek <hadacek@kde.org>             *
 *                                                                         *
 *   This program is free software; you can redistribute it and/or modify  *
 *   it under the terms of the GNU General Public License as published by  *
 *   the Free Software Foundation; either version 2 of the License, or     *
 *   (at your option) any later version.                                   *
 ***************************************************************************/
#ifndef PURL_BASE_H
#define PURL_BASE_H

#include "common/global/global.h"
#include "common/common/key_enum.h"

//----------------------------------------------------------------------------
namespace PURL
{
BEGIN_DECLARE_ENUM(ToolType)
  Assembler = 0, Compiler
END_DECLARE_ENUM_STD(ToolType)

enum FileTypeEnum {
  AsmGPAsm = 0, AsmPIC30, AsmPICC, Inc, CSource, CppSource, CHeader, JalSource, BasicSource,
  Object, Library, Lkr, Gld, Hex, Elf, Project, Lst, Map, Cod, Coff,
  Unknown, PikdevProject,
  Nb_FileTypes
};

struct SourceFamilyData {
  ToolType     toolType;
  const char  *key, *label;
  FileTypeEnum headerType;
};
BEGIN_DECLARE_ENUM(SourceFamily)
  Asm = 0, C, JAL, Cpp, Basic
END_DECLARE_ENUM(SourceFamily, SourceFamilyData)

enum FileGroup { Source = 0, Header, LinkerScript, LinkerObject, Nb_FileGroups };

enum FileProperty { NoProperty = 0, Editable = 1, ReadOnly = 2 };
TQ_DECLARE_FLAGS(FileProperties, FileProperty)
TQ_DECLARE_OPERATORS_FOR_FLAGS(FileProperties)

struct FileTypeData {
  const char *key;
  FileGroup group;
  FileProperties properties;
  SourceFamily sourceFamily;
  const char *label;
  const char *extensions[10];
  const char **xpm_icon;
  const char *mimetype;
  const char *highlightModeName;
};
#ifndef TQ_TQMOC_RUN // needed because TQMOC does not expand defines...
class FileType : public GenericEnum
{
public:
  typedef FileTypeEnum Type;
  enum { Nb_Types = Nb_FileTypes };
  typedef FileTypeData Data;
DECLARE_DATA
DECLARE_ENUM_CLASS(FileType)
#endif

// add correct extension if filename has no extension
extern TQString addExtension(const TQString &filename, FileType type);
extern TQString extension(FileType type);
extern TQString extensions(FileType type);
extern TQString filter(FileType type);
enum FilterType { SimpleFilter, CompleteFilter };
extern TQString sourceFilter(FilterType type);
extern TQString objectFilter(FilterType type);
extern TQString projectFilter(FilterType type);
extern TQString extensions(FileGroup group);

} // namespace

#endif