1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 #include <precomp.h> 23 #include <ary/loc/loc_traits.hxx> 24 25 26 // NOT FULLY DEFINED SERVICES 27 #include <ary/namesort.hxx> 28 #include <ary/getncast.hxx> 29 #include "locs_le.hxx" 30 31 32 33 namespace ary 34 { 35 namespace loc 36 { 37 38 39 //******************** Le_Traits ************************// 40 Le_Traits::entity_base_type & EntityOf_(id_type i_id)41Le_Traits::EntityOf_(id_type i_id) 42 { 43 csv_assert(i_id.IsValid()); 44 return Le_Storage::Instance_()[i_id]; 45 } 46 47 //******************** LeNode_Traits ************************// 48 symtree::Node<LeNode_Traits> * NodeOf_(entity_base_type & io_entity)49LeNode_Traits::NodeOf_(entity_base_type & io_entity) 50 { 51 if (is_type<Directory>(io_entity)) 52 return & ary_cast<Directory>(io_entity).AsNode(); 53 return 0; 54 } 55 56 Le_Traits::entity_base_type * ParentOf_(const entity_base_type & i_entity)57LeNode_Traits::ParentOf_(const entity_base_type & i_entity) 58 { 59 Le_Traits::id_type 60 ret = i_entity.ParentDirectory(); 61 if (ret.IsValid()) 62 return &EntityOf_(ret); 63 return 0; 64 } 65 66 //******************** Le_Compare ************************// 67 const Le_Compare::key_type & KeyOf_(const entity_base_type & i_entity)68Le_Compare::KeyOf_(const entity_base_type & i_entity) 69 { 70 return i_entity.LocalName(); 71 } 72 73 bool Lesser_(const key_type & i_1,const key_type & i_2)74Le_Compare::Lesser_( const key_type & i_1, 75 const key_type & i_2 ) 76 { 77 static ::ary::LesserName less_; 78 return less_(i_1,i_2); 79 } 80 81 82 83 84 } // namespace loc 85 } // namespace ary 86