// DIE's signature file
// Author: Jason Hood <jadoxa@yahoo.com.au>

init("source","C/C++");

function detect(bShowType,bShowVersion,bShowOptions)
{
    var sText=Binary.getHeaderString();
    if(/^#ifndef (\w+).*\s+^#define \1/m.test(sText)
     ||/#\s*pragma (?:once|hdrstop)/.test(sText))
    {
        sOptions="header";
        bDetected=1;
    }
    if(/^(?:class\b|virtual\b|public:|private:|template\b)/m.test(sText))
    {
        if(!(/\sdef\s/.test(sText))) // to avoid false positives on python
        {
            sName="C++";
            bDetected=1;
        }
    }
    else
    {
        var aInclude=sText.match(/^#include ["<].*?[>"]/mg);
        if(aInclude)
        {
            bDetected=1;
            for(var i=0;i<aInclude.length;i++)
            {
                if(aInclude[i].indexOf(".")<0)
                {
                    sName="C++";
                    break;
                }
            }
        }
        else if(/^#define/m.test(sText))
        {
            bDetected=1;
        }
    }

    return result(bShowType,bShowVersion,bShowOptions);
}
