Accessing/get the specific content of the Clang AST - clang

below is a picture of the clangAST of a code segment. Does anyone know how to access the attributes in yellow? What are the attributes of the corresponding class?

Related

Is it possible to specify metadata on object display when DisplayForModel doesn't apply?

I've got a situation where I want to show an object that isn't attached to a model, but I'd like to specify metadata for it so that the templating system displays it as if it were a model property with specified metadata. Something like:
#Html.DisplayObject(obj, metadata) <--pseudocode
That is, I have a free object obj and I know how I want it to be displayed (usual metadata stuff like DisplayName, FormatString, UIHint, etc.), but this object isn't attached to a model.
How can I hook into MVC's default templating logic in this situation?
(The reason the object isn't attached to a model, by the way, is that it's loaded dynamically at runtime, so there's no compile time place to add the property and decorate it with the metadata attributes. So I may really be asking about the right way to handle this situation.)
One possible option here is to implement your custom metadata provider. I never did it myself but this article on the topic looked useful and detailed.
Not a brilliant answer by any means, but in the end I just manually implemented the UI that I needed, factored into useful partial views and helper methods, and it really wasn't that hard. I also have complete control, which is nice.

Can you change a custom attribute from a controller in ASP.NET MVC?

I am looking to have an attribute "show" on certain properties in my class and give the user the option to show other properties in the view.
Can I change a custom attribute from the front end?
Are you talking about the Filter attributes? If you are, you cannot change properties as they are statically defined, unless the code within the attribute happens to reference a static class or within the context at execution time, and then you pretty much can access within the attribute anything from that static or the context...
If I'm on the wrong track, please let me know.
HTH.
I am not sure attributes are the best approach for dynamically attaching metadata. Normally attributes are attached at code generation time.

Generate columnheaders based on the DisplayName attribute?

When I generate a view from the List template I notice that the names of the columns are not based on the DisplayName() annotation. I know how to edit the list.tt code template but I have no idea how to retrieve the DisplayName attributes from the class properties.
The common way to get the DisplayName attribute is via reflection. The issue your going to have is .tt templates and reflection don't play nice together. Reflection relies on code being loaded into the AppDomain. Since .tt files don't actually load code you can't reflect over them.
More information about this issue, and a possible solution here:
http://www.olegsych.com/2007/12/how-to-use-t4-to-generate-decorator-classes/
MVC and Visual Studio must use some type of code inspection to generate some of the generated so I'd look along that path, maybe some crazy regex, if your not into solving the reflection issue.

How can I see the type of a property in the Object Inspector?

In the form designer, I sometimes need to see the type of a property, so I know what kind of input it expects. Unfortunately the Object Inspector doesn't seem to show it.
Example:
This component clearly wants me to link a "Grid", but I have no idea what type of grid I need. TDbGrid? TDrawGrid? TColorGrid? TGridPanel?
Of course I can see this by looking into the source of the component, but does anyone know a faster way?
Unfortunately, there doesn't seem to be any way to get at this from the Object Inspector. You can always go into the code somewhere and type JvGridFilter1.Grid and press CTRL-SPACE and see what comes up, but that's pretty much the same as looking into the code. I don't think there's any easier way to do it.
Try submitting that to QC as a feature request.

How to sort data as I want in a VirtualExplorerTreeview (VirtualShellTools)

This is probably a very "dumb" question for whoever knows VirtualShellTools but I only started using it and couldn't find my answer in the demos' code. Please note that I'm also unfamiliar with virtualtreeview.
I use a VirtualExplorerTreeview to display a directory structure, linked with a VirtualExplorerListview to display a certain type of files in the selected directory as well as specific informations about them
I've been able to point them at the right place, link them as I wanted, filter everything in the listview, and looking at the demos I have a pretty good idea about how to add my own columns and draw it to display my custom data.
My issue lies with the Treeview: I would like to sort the directories displayed in the order I want; specifically, I want "My Docs" and other folder to appears first, then drives, then removable media. Looking in the TNamespace property I found how to distinguish them (Directory and Removable properties), but I don't know how to implement my own sort/what event I need. I tried CompareNode but that doesn't even seem to be called.
If you want to do everything yourself, then set toUserSort in the TVirtualExplorerTree.TreeOptions.VETMiscOptions property. That causes the control to just use the DoCompare method inherited from the virtual tree view, and that should call the OnCompareNodes event handler.
A better way is to provide a custom TShellSortHelper. Make a descendant of that class and override whichever methods you need. Create an instance of that class and assign it to the tree's SortHelper property. (The tree takes ownership of the helper; free the old one, but not the new one.) If the items are being sorted on a column that that class doesn't know how to compare, then handle the tree's OnCustomColumnCompare event.
To help you figure out exactly which methods you need to override or events you need to handle, set a breakpoint in TCustomVirtualExplorerTree.DoCompare and step through to see what gets called in various situations.

Resources