Charmed Quark Systems
Google
WWW CharmedQuark.com

Go Back   Charmed Quark Systems > General Discussion > CQC Support
Register FAQ Members List Calendar Mark Forums Read

CQC Support Report bugs, make wishes, discuss plans, ask questions

Reply
 
Thread Tools Display Modes
  #1  
Old 10-06-2006, 01:33 PM
beelzerob beelzerob is offline
 
Join Date: Mar 2006
Location: Central PA
Posts: 4,815
Default Enums and GetText()

Is it possible to get the text of an enum, without first assigning it to a variable?

So, if there is an enum that defines:
Enum Myenum
stuff : "ThisStuff";
EndEnum

Can I then reference in the code:

Myenum.stuff.GetText()

and get "ThisStuff"?

I'm thinking I CAN'T, and I'm thinking that instead of an enum, I should probably just declare constants for what I want instead.
__________________
My Android Weather Alert App
Reply With Quote
  #2  
Old 10-06-2006, 02:20 PM
Dean Roddey's Avatar
Dean Roddey Dean Roddey is offline
Administrator
 
Join Date: Aug 2002
Location: Mountain View, CA
Posts: 32,465
Default

You ahve to actually create an enumerated value and set it. But if you are looking for something use in a driver to translate back and forth between an internal and external value, enums are very much designed to do that.

What you do is set the left side to the internal and the right side to the external (or vice versa), and you can do SetText() or SetName() on it from the text, then read the other value out. You do need to put an exception handler around it though, in case the text/name you are setting turns out not to be one of the actual values.
__________________
Dean Roddey
Software Geek Extraordinaire
Reply With Quote
  #3  
Old 10-06-2006, 02:44 PM
beelzerob beelzerob is offline
 
Join Date: Mar 2006
Location: Central PA
Posts: 4,815
Default

Well, what I had was an enumerated list of strings that represented certain status requests (PowerStatusReq, VolumeStatusReq, etc). They were all related, in that they were all status requests, but otherwise, they really don't benefit from being enumerations. I'll just change 'em to literals.
__________________
My Android Weather Alert App
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:39 AM.


Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.