/* Function: Database_OutputFolder * * Returns the output folder for database files, optionally for the partial symbol within it. * * - If the partial symbol isn't specified, it returns the output folder for all database files. * - If partial symbol is specified, it returns the output folder for that symbol. */ public Path Database_OutputFolder(SymbolString partialSymbol = default(SymbolString)) { StringBuilder result = new StringBuilder(OutputFolder); result.Append("/database"); if (partialSymbol != null) { result.Append('/'); string pathString = partialSymbol.FormatWithSeparator('/'); result.Append(SanitizePath(pathString)); } return(result.ToString()); }
/* Function: OutputFolder * * Returns the output folder for database files, optionally for the passed qualifier within it. * * - If the qualifier isn't specified, it returns the root output folder for all database files. * - If the qualifier is specified, it returns the output folder for that qualifier. * * Examples: * * targetOutputFolder - C:\Project\Documentation\database * targetOutputFolder + qualifier - C:\Project\Documentation\database\Qualifier1\Qualifier2 */ static public Path OutputFolder(Path targetOutputFolder, SymbolString qualifier = default(SymbolString)) { StringBuilder result = new StringBuilder(targetOutputFolder); result.Append("/database"); if (qualifier != null) { result.Append('/'); string pathString = qualifier.FormatWithSeparator('/'); result.Append(Utilities.Sanitize(pathString)); } return(result.ToString()); }
/* Function: QualifierHashPath * * Returns the qualifier part of the hash path for classes. If the qualifier symbol is specified it will include a * trailing member operator so that the last segment can simply be concatenated. * * - If language ID is specified but the qualifier is not, it returns the prefix for all class paths of that language. * - If language ID and qualifier are specified, it returns the prefix plus the hash path for that qualifier6, including * a trailing separator. * * Examples: * * simpleLanguageID - CSharpClass: * simpleLanguageID + qualifier - CSharpClass:Namespace1.Namespace2. */ static public string QualifierHashPath(string simpleLanguageID, SymbolString qualifier = default(SymbolString)) { StringBuilder result = new StringBuilder(); result.Append(simpleLanguageID); result.Append("Class:"); if (qualifier != null) { string pathString = qualifier.FormatWithSeparator('.'); result.Append(Utilities.Sanitize(pathString)); result.Append('.'); } return(result.ToString()); }
/* Function: Database_OutputFolderHashPath * Returns the hash path of the output folder for database files, optionally for the partial symbol within. The hash path will * always include a trailing symbol so that the file name can simply be concatenated. * * - If the partial symbol isn't specified, it returns the prefix for all database members. * - If the partial symbol is specified, it returns the hash path for that symbol. */ public string Database_OutputFolderHashPath(SymbolString partialSymbol = default(SymbolString)) { if (partialSymbol == null) { return("Database:"); } else { StringBuilder result = new StringBuilder("Database:"); if (partialSymbol != null) { string pathString = partialSymbol.FormatWithSeparator('.'); result.Append(SanitizePath(pathString)); result.Append('.'); } return(result.ToString()); } }
/* Function: QualifierHashPath * * Returns the qualifier part of the hash path for databases. If the qualifier symbol is specified it will include a * trailing member operator so that the last segment can simply be concatenated. If no qualifier is specified, it * returns the prefix for all database hash paths. */ static public string QualifierHashPath(SymbolString qualifier = default(SymbolString)) { if (qualifier == null) { return("Database:"); } else { StringBuilder result = new StringBuilder("Database:"); if (qualifier != null) { string pathString = qualifier.FormatWithSeparator('.'); result.Append(Utilities.Sanitize(pathString)); result.Append('.'); } return(result.ToString()); } }
// Group: Path Functions // __________________________________________________________________________ /* Function: Class_OutputFolder * * Returns the output folder for class files, optionally for the passed language and partial symbol within it. * * - If language isn't specified, it returns the output folder for all class files. * - If language is specified but the symbol is not, it returns the output folder for all class files of that language. * - If language and partial symbol are specified, it returns the output folder for that symbol. */ public Path Class_OutputFolder(Language language = null, SymbolString partialSymbol = default(SymbolString)) { StringBuilder result = new StringBuilder(OutputFolder); result.Append("/classes"); if (language != null) { result.Append('/'); result.Append(language.SimpleIdentifier); if (partialSymbol != null) { result.Append('/'); string pathString = partialSymbol.FormatWithSeparator('/'); result.Append(SanitizePath(pathString)); } } return(result.ToString()); }
/* Function: Class_OutputFolderHashPath * Returns the hash path of the output folder for class files, optionally for the passed language and partial symbol * within. The hash path will always include a trailing symbol so that the file name can simply be concatenated. * * - If language isn't specified, it returns null since there is no common prefix for all class paths. * - If language is specified but the symbol is not, it returns the prefix for all class paths of that language. * - If language and partial symbol are specified, it returns the hash path for that symbol. */ public string Class_OutputFolderHashPath(Language language = null, SymbolString partialSymbol = default(SymbolString)) { if (language == null) { return(null); } StringBuilder result = new StringBuilder(); result.Append(language.SimpleIdentifier); result.Append("Class:"); if (partialSymbol != null) { string pathString = partialSymbol.FormatWithSeparator('.'); result.Append(SanitizePath(pathString)); result.Append('.'); } return(result.ToString()); }
/* Function: OutputFolder * * Returns the output folder for class files, optionally for the passed language and qualifier within it. * * - If language isn't specified, it returns the output folder for all class files. * - If language is specified but the qualifier is not, it returns the output folder for all class files of that language. * - If language and qualifier are specified, it returns the output folder for that qualifier. * * Examples: * * targetOutputFolder - C:\Project\Documentation\classes * targetOutputFolder + simpleLanguageID - C:\Project\Documentation\classes\CSharp * targetOutputFolder + simpleLanguageID + qualifier - C:\Project\Documentation\classes\CSharp\Namespace1\Namespace2 */ static public Path OutputFolder(Path targetOutputFolder, string simpleLanguageID = null, SymbolString qualifier = default(SymbolString)) { StringBuilder result = new StringBuilder(targetOutputFolder); result.Append("/classes"); if (simpleLanguageID != null) { result.Append('/'); result.Append(simpleLanguageID); if (qualifier != null) { result.Append('/'); string pathString = qualifier.FormatWithSeparator('/'); result.Append(Utilities.Sanitize(pathString)); } } return(result.ToString()); }
// Group: Functions // __________________________________________________________________________ public TopicEntry(Topic topic, SearchIndex.Manager manager) : base() { this.topic = topic; var commentType = manager.EngineInstance.CommentTypes.FromID(topic.CommentTypeID); var language = manager.EngineInstance.Languages.FromID(topic.LanguageID); // Get the title without any parameters. We don't want to include parameters in the index. Multiple functions that // differ only by parameter will be treated as one entry. string title, ignore; ParameterString.SplitFromParameters(topic.Title, out title, out ignore); title = title.TrimEnd(); // Figure out the extra scope text that should be added to the title to make it a fully resolved symbol. We do this by // comparing the symbol from the topic to one generated from the title. We don't just use the symbol to begin with // because we want to show the title as written; there's some normalization that occurs when generating symbols // that we want to bypass. string extraScope = null; SymbolString titleSymbol = SymbolString.FromPlainText_NoParameters(title); string titleSymbolString = titleSymbol.FormatWithSeparator(language.MemberOperator); string symbolString = topic.Symbol.FormatWithSeparator(language.MemberOperator); if (symbolString.Length > titleSymbolString.Length) { // We have to go by LastIndexOf rather than EndsWith because operator<string> will have <string> cut off as a parameter. // We have to go by LastIndexOf instead of IndexOf so constructors don't get cut off (Package.Class.Class). int titleIndex = symbolString.LastIndexOf(titleSymbolString); #if DEBUG if (titleIndex == -1) { throw new Exception("Title symbol string \"" + titleSymbolString + "\" isn't part of symbol string \"" + symbolString + "\" which " + "was assumed when creating a search index entry."); } #endif extraScope = symbolString.Substring(0, titleIndex); } // Remove the space in "operator <". This prevents them from appearing as two keywords, and also makes sure "operator <" and // "operator<" are always displayed consistently, which will be important for sorting. title = SpaceAfterOperatorKeywordRegex.Replace(title, ""); displayName = (extraScope == null ? title : extraScope + title); searchText = Normalize(displayName); if (commentType.Flags.File) { endOfDisplayNameQualifiers = EndOfQualifiers(displayName, FileSplitSymbolsRegex.Matches(displayName)); endOfSearchTextQualifiers = EndOfQualifiers(searchText, FileSplitSymbolsRegex.Matches(searchText)); } else if (commentType.Flags.Code) { endOfDisplayNameQualifiers = EndOfQualifiers(displayName, CodeSplitSymbolsRegex.Matches(displayName)); endOfSearchTextQualifiers = EndOfQualifiers(searchText, CodeSplitSymbolsRegex.Matches(searchText)); } else // documentation topic { if (extraScope == null) { endOfDisplayNameQualifiers = 0; endOfSearchTextQualifiers = 0; } else { endOfDisplayNameQualifiers = extraScope.Length; // Don't need +1 because only leading separators are removed. The trailing separator will still be there. endOfSearchTextQualifiers = Normalize(extraScope).Length; } } keywords = new List <string>(); if (endOfDisplayNameQualifiers == 0) { AddKeywords(displayName, commentType.Flags.Documentation); } else { AddKeywords(displayName.Substring(endOfDisplayNameQualifiers), commentType.Flags.Documentation); } }