<commit_before>//
//  DTTableViewController.h
//  DTTableViewController
//
//  Created by <NAME> on 6/19/12.
//  Copyright (c) 2012 MLSDev. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import "DTTableViewModelTransfer.h"
#import "DTTableViewModelSearching.h"

/**
 `DTTableViewController` manages all `UITableView` datasource methods and provides API for managing your data models in the table. 
 
 ## Setup
 
 # General steps
 - You should have custom `UITableViewCell` subclasses that manage cell layout, using given data model (or `DTTableViewCell`, which is UITableViewCell subclass, that conforms to `DTTableViewModelTransfer` protocol)
 - Every cell class should be mapped to model class using mapping methods.
 - `UITableView` datasource and delegate is your `DTTableViewController` subclass.
  
 ## Managing table items
 
 Every action that is done to table items - add, delete, insert etc. is applied immediately. There's no need to manually reload data on your table view. Group insertion, addition or deletion is processed inside `UITableView` `beginUpdates` and `endUpdates` block. All methods for tableItems manipulation will automatically update both original tableView and filtered tableView, when search is active.
 
 ## Mapping cells
 
 Use `registerCellClass:forModelClass` for mapping cell class to model. 'DTTableViewController' will automatically check, if there's a nib with the same name as cellClass. If it is - this nib is registered for modelClass. If there's no nib - then cell will be created using initWithStyle: method on cellClass. If you need nib name for the cell to differ from cellClass name, use `registerNibName:forCellClass:modelClass:`.
 
 Before executing mapping methods, make sure that tableView property is set and tableView is created. Good spot to call `registerCellClass:forModelClass` is in viewDidLoad method.

 ## Search
 
 Your data models should conform to `DTTableViewModelSearching` protocol. You need to implement method shouldShowInSearchResultsForSearchString:inScopeIndex: on your data model, this way DTTableViewController will know, when to show data models.
 
 # Automatic
 
Set UISearchBar's delegate property to your `DTTableViewController` subclass. That's it, you've got search implemented!
 
 # Manual
 
 Any time you need your models sorted, call method filterTableItemsForSearchString:. Every data model in the table will be called with method shouldShowInSearchResultsForSearchString:inScopeIndex: and tableView will be automatically updated with results.
 
 ## Loading headers/footers from NIB
 
 To register custom NIB for header/footer use methods `registerHeaderClass:modelClass:` and `registerFooterClass:modelClass:` methods. If nib name is different from the class name, use `registerNibName:forHeaderClass:modelClass:` or `registerNibName:forFooterClass:modelClass:` method.
 
 For iOS 6 and higher, UITableView's `registerNib:forHeaderFooterViewReuseIdentifier:` will be used. For iOS 5, `DTTableViewController` will use `loadFromNibName:bundle:` method. `DTTableViewController` will automatically figure out, which view class is used.
 
 To set header/footer models on the  tableView, use `sectionHeaderModels` and `sectionFooterModels` properties. Keep in mind, there's no public method to reload header/footer views, so after header/footer models are set, you will need to manually reload table with `reloadData` or `reloadSections:withRowAnimation` method.
 
 Also, `tableView:heightForHeaderInSection:` and `tableView:heightForFooterInSection:` methods need to be implemented for custom headers/footers to correctly work.
 
*/

@interface DTTableViewController : UIViewController
                                     <UITableViewDataSource,
                                        UITableViewDelegate,
                                        UISearchBarDelegate>

///---------------------------------------
/// @name Properties
///---------------------------------------

/**
 
 Table view that will present your data models.
 */
@property (nonatomic, strong) IBOutlet UITableView * tableView;

/*
 Property to store UISearchBar, attached to your UITableView. Attaching it to this property is completely optional.
 */
@property (nonatomic, strong) IBOutlet UISearchBar * searchBar;

/**
 Array of NSString header titles, used in UITableViewDatasource `tableView:titleForHeaderInSection:` method.
 */
@property (nonatomic,strong) NSMutableArray * sectionHeaderTitles;

/**<commit_msg>remove old note on custom headers and footers<commit_after>//
//  DTTableViewController.h
//  DTTableViewController
//
//  Created by <NAME> on 6/19/12.
//  Copyright (c) 2012 MLSDev. All rights reserved.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

#import "DTTableViewModelTransfer.h"
#import "DTTableViewModelSearching.h"

/**
 `DTTableViewController` manages all `UITableView` datasource methods and provides API for managing your data models in the table. 
 
 ## Setup
 
 # General steps
 - You should have custom `UITableViewCell` subclasses that manage cell layout, using given data model (or `DTTableViewCell`, which is UITableViewCell subclass, that conforms to `DTTableViewModelTransfer` protocol)
 - Every cell class should be mapped to model class using mapping methods.
 - `UITableView` datasource and delegate is your `DTTableViewController` subclass.
  
 ## Managing table items
 
 Every action that is done to table items - add, delete, insert etc. is applied immediately. There's no need to manually reload data on your table view. Group insertion, addition or deletion is processed inside `UITableView` `beginUpdates` and `endUpdates` block. All methods for tableItems manipulation will automatically update both original tableView and filtered tableView, when search is active.
 
 ## Mapping cells
 
 Use `registerCellClass:forModelClass` for mapping cell class to model. 'DTTableViewController' will automatically check, if there's a nib with the same name as cellClass. If it is - this nib is registered for modelClass. If there's no nib - then cell will be created using initWithStyle: method on cellClass. If you need nib name for the cell to differ from cellClass name, use `registerNibName:forCellClass:modelClass:`.
 
 Before executing mapping methods, make sure that tableView property is set and tableView is created. Good spot to call `registerCellClass:forModelClass` is in viewDidLoad method.

 ## Search
 
 Your data models should conform to `DTTableViewModelSearching` protocol. You need to implement method shouldShowInSearchResultsForSearchString:inScopeIndex: on your data model, this way DTTableViewController will know, when to show data models.
 
 # Automatic
 
Set UISearchBar's delegate property to your `DTTableViewController` subclass. That's it, you've got search implemented!
 
 # Manual
 
 Any time you need your models sorted, call method filterTableItemsForSearchString:. Every data model in the table will be called with method shouldShowInSearchResultsForSearchString:inScopeIndex: and tableView will be automatically updated with results.
 
 ## Loading headers/footers from NIB
 
 To register custom NIB for header/footer use methods `registerHeaderClass:modelClass:` and `registerFooterClass:modelClass:` methods. If nib name is different from the class name, use `registerNibName:forHeaderClass:modelClass:` or `registerNibName:forFooterClass:modelClass:` method.
 
 For iOS 6 and higher, UITableView's `registerNib:forHeaderFooterViewReuseIdentifier:` will be used. For iOS 5, `DTTableViewController` will use `loadFromNibName:bundle:` method. `DTTableViewController` will automatically figure out, which view class is used.
 
 To set header/footer models on the  tableView, use `sectionHeaderModels` and `sectionFooterModels` properties. Keep in mind, there's no public method to reload header/footer views, so after header/footer models are set, you will need to manually reload table with `reloadData` or `reloadSections:withRowAnimation` method.
*/

@interface DTTableViewController : UIViewController
                                     <UITableViewDataSource,
                                        UITableViewDelegate,
                                        UISearchBarDelegate>

///---------------------------------------
/// @name Properties
///---------------------------------------

/**
 
 Table view that will present your data models.
 */
@property (nonatomic, strong) IBOutlet UITableView * tableView;

/*
 Property to store UISearchBar, attached to your UITableView. Attaching it to this property is completely optional.
 */
@property (nonatomic, strong) IBOutlet UISearchBar * searchBar;

/**
 Array of NSString header titles, used in UITableViewDatasource `tableView:titleForHeaderInSection:` method.
 */
@property (nonatomic,strong) NSMutableArray * sectionHeaderTitles;

/**
{'fraction_non_alphanumeric': 0.07660550458715597, 'fraction_numerical': 0.002018348623853211, 'mean_word_length': 4.037430683918669, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1357051', 'n_tokens_mistral': 2765, 'n_tokens_neox': 2491, 'n_words': 1270}