47 char line[1024] = {0};
48 char mime[1024] = {0};
49 char pattern[256] = {0};
51 char sicon[256] = {0};
71 while (*s ==
' ') s++;
72 if (*s ==
'#')
continue;
80 if (!
strncmp(s,
"pattern", 7)) {
82 Error(
"TGMimeTypes",
"malformed pattern line, = missing");
91 }
else if (!
strncmp(s,
"icon", 4)) {
93 Error(
"TGMimeTypes",
"malformed icon line, = missing");
113 }
else if (!
strncmp(s,
"action", 6)) {
115 Error(
"TGMimeTypes",
"malformed action line, = missing");
127 if (
strchr(pattern,
' ')) {
159 fClient(
gmt.fClient),
160 fFilename(
gmt.fFilename),
161 fChanged(
gmt.fChanged),
260 while ((
m = (
TGMime *) next())) {
261 printf(
"Type: %s\n",
m->fType.Data());
262 printf(
"Pattern: %s\n",
m->fPattern.Data());
263 if (
m->fIcon !=
m->fSIcon)
264 printf(
"Icon: %s %s\n",
m->fIcon.Data(),
m->fSIcon.Data());
266 printf(
"Icon: %s\n",
m->fIcon.Data());
267 printf(
"Action: %s\n",
m->fAction.Data());
268 printf(
"------------\n\n");
287 Error(
"SaveMimes",
"can not open %s to store mime types",
filename.Data());
297 while ((
m = (
TGMime *) next())) {
298 fprintf(fp,
"%s\n",
m->fType.Data());
299 fprintf(fp,
"pattern = %s\n",
m->fPattern.Data());
300 if (
m->fIcon !=
m->fSIcon)
301 fprintf(fp,
"icon = %s %s\n",
m->fIcon.Data(),
m->fSIcon.Data());
303 fprintf(fp,
"icon = %s\n",
m->fIcon.Data());
304 fprintf(fp,
"action = %s\n\n",
m->fAction.Data());
321 mime->fPattern = pattern;
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char filename
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h Atom_t Int_t ULong_t ULong_t unsigned char prop_list Atom_t Atom_t Atom_t Time_t type
char * Strip(const char *str, char c=' ')
Strip leading and trailing c (blanks by default) from a string.
R__EXTERN TSystem * gSystem
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
const TGPicture * GetPicture(const char *name)
Get picture from the picture pool.
This class handles mime types, used by browsers to map file types to applications and icons.
TGMimeTypes & operator=(const TGMimeTypes &gmt)
Assignment operator.
Bool_t fChanged
true if file has changed
void SaveMimes()
Save mime types in user's mime type file.
TGMime * Find(const char *filename)
Given a filename find the matching mime type object.
void AddType(const char *type, const char *pat, const char *icon, const char *sicon, const char *action)
Add a mime type to the list of mime types.
TOrdCollection * fList
list of mime types
TGMimeTypes(const TGMimeTypes &gmt)
Copy constructor.
~TGMimeTypes() override
Delete mime type pool.
TGClient * fClient
client to which mime types belong (display server)
void Print(Option_t *option="") const override
Print list of mime types.
const TGPicture * GetIcon(const char *filename, Bool_t small_icon)
Return icon belonging to mime type of filename.
Bool_t GetAction(const char *filename, char *action)
Return in action the mime action string belonging to filename.
Bool_t GetType(const char *filename, char *type)
Return in type the mime type belonging to filename.
TString fFilename
file name of mime type file
TGMime is internally used by TGMimeTypes.
TRegexp * fReg
pattern regular expression
~TGMime() override
Delete mime object.
The TGPicture class implements pictures and icons used in the different GUI elements and widgets.
Mother of all ROOT objects.
TObject & operator=(const TObject &rhs)
TObject assignment operator.
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
void AddFirst(TObject *obj) override
Insert object at beginning of collection.
void Delete(Option_t *option="") override
Remove all objects from the collection AND delete all heap based objects.
Regular expression class.
virtual const char * HomeDirectory(const char *userName=nullptr)
Return the user's home directory.