MCPcopy Create free account
hub / github.com/Autodesk/AutomaticComponentToolkit / decomposeVersionString

Function decomposeVersionString

Source/componentdefinition.go:806–833  ·  view source on GitHub ↗
(version string)

Source from the content-addressed store, hash-verified

804}
805
806func decomposeVersionString(version string) (bool, [3]int, [2]string) {
807 var IsValidVersion = regexp.MustCompile("^([0-9]+)\\.([0-9]+)\\.([0-9]+)(\\-[a-zA-Z0-9.\\-]+)?(\\+[a-zA-Z0-9.\\-]+)?$")
808
809 var vers [3]int;
810 var data [2]string;
811
812 if !(IsValidVersion.MatchString(version)) {
813 return false, vers, data;
814 }
815 slices := IsValidVersion.FindStringSubmatch(version)
816 if (len(slices) != 6) {
817 return false, vers, data;
818 }
819 for i := 0; i < 3; i++ {
820 ver, err := strconv.Atoi(slices[i+1])
821 if err != nil {
822 return false, vers, data;
823 }
824 vers[i] = ver
825 }
826 for i := 0; i < 2; i++ {
827 slice := slices[i+4]
828 if (len(slice)>0) {
829 data[i] = slice[1:]
830 }
831 }
832 return true, vers, data;
833}
834
835func nameSpaceIsValid(namespace string) bool {
836 var IsValidNamespace = regexp.MustCompile("^[A-Z][a-zA-Z0-9_]{0,63}$").MatchString

Callers 6

majorVersionFunction · 0.85
minorVersionFunction · 0.85
microVersionFunction · 0.85
preReleaseInfoFunction · 0.85
buildInfoFunction · 0.85
checkComponentHeaderMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected