Home | History | Annotate | Download | only in build
      1 // Copyright (C) 2017 The Android Open Source Project
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use this file except in compliance with the License.
      5 // You may obtain a copy of the License at
      6 //
      7 //     http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 
     15 package hidl
     16 
     17 // wrap(p, a, s) = [p + v + s for v in a]
     18 func wrap(prefix string, strs []string, suffix string) []string {
     19 	ret := make([]string, len(strs))
     20 	for i, v := range strs {
     21 		ret[i] = prefix + v + suffix
     22 	}
     23 	return ret
     24 }
     25 
     26 // concat(a...) = sum((i for i in a), [])
     27 func concat(sstrs ...[]string) []string {
     28 	var ret []string
     29 	for _, v := range sstrs {
     30 		ret = append(ret, v...)
     31 	}
     32 	return ret
     33 }
     34 
     35 func remove(str string, strs []string) []string {
     36 	var ret []string
     37 	for _, v := range strs {
     38 		if v != str {
     39 			ret = append(ret, v)
     40 		}
     41 	}
     42 	return ret
     43 }
     44