Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Adding Descriptions to properties and methods???
Message
From
15/08/2011 11:58:14
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Adding Descriptions to properties and methods???
Environment versions
Visual FoxPro:
VFP 9 SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01521009
Message ID:
01521009
Views:
140
In a class definitions contained in a VCX, you can add a Description to each custom property and method that you define.

However, I am creating a class definitions in a PRG file, and I want to know if there is a standard way of using comments or some other kind of markup in the class definition to include descriptions for the properties and methods?

I don't think there is an official VFP coding rule for this, so I guess I'm asking if there is a widely adopted standard among VFP coders who use PRG-based classes. I know that C# has a standard way of adding descriptions to its properties and methods, and I'm wishing (hoping) VFP has a standard as well.

Why does this matter? Well, for one, I would hope to be able to create documentation for the class definition (from a documentation tool) where I could extract this description info right from the PRG. I'm not looking to create my own format, if there is a (widely used) standard already in place. In order for the documentation tool to work properly, it would expect the correct format, syntax, location, etc be used consistently.

Any standard format out there?
Define Class Example as Custom

    nProperty1 = 1 && Description of property goes here??

    * Description of property goes here??
    cProperty2 = 'SomeProp'

    * Description of property goes here??
    * Could span across multiple lines??
    cProperty3 = 'SomeProp'

    * Description of method goes here??
    * Could span across multiple lines??
    Procedure MethodOne(tnParameter1, tcParameter2) 
     *-- Code goes here
    EndProc


EndDefine
As an example, here is how it's handled in C#:

This show a method definition, with the description located above it using /// and some xml tags. Notice that you can also describe parameters.
        /// <summary>
        /// Updates the loaded entity with the contents from a quote object
        /// </summary>
        /// <param name="quote"></param>
        public void UpdateEntityFromStockQuote(StockQuote quote)
        {
            if (this.Entity == null)
                return;

            if ( !string.IsNullOrEmpty(quote.Company) )
                this.Entity.Company = quote.Company;

            // if the price isn't set service is down or not providing data at the moment
            if ( quote.LastPrice == 0.00M )
                return;

            this.Entity.LastPrice = quote.LastPrice;
            this.Entity.LastDate = quote.LastQuoteTime;
            this.Entity.OpenPrice = quote.OpenPrice;
            this.Entity.Change = quote.NetChange;
            this.Entity.LastDate = quote.LastQuoteTime;

            this.Entity.ItemValue = this.Entity.LastPrice * this.Entity.Qty;
        }
Next
Reply
Map
View

Click here to load this message in the networking platform